Add: get avatar from file

This commit is contained in:
2022-12-01 23:05:34 +08:00
parent 9fdea6b169
commit 271c7e5c13
4 changed files with 71 additions and 2 deletions

View File

@@ -3,7 +3,8 @@ html {
}
body {
margin: auto;
margin-top: 1rem;
padding-top: 1rem;
background-color: var(--background, 33);
}
.base {
display: grid;

View File

@@ -27,6 +27,27 @@ function App() {
const [user, setUser] = useState({});
const [langCode, setLangCode] = useState("en_US");
useEffect(() => {
if (playingFile.id === undefined) {
return;
}
const html = document.getElementsByTagName("html")[0];
const retStyle = html.style;
const bodyRetStyle = document.body.style
html.style = `
backdrop-filter: blur(10px);
background-size: cover;
background-attachment: fixed;
background-position: center;
background-image: url("/api/v1/get_file_avatar?id=${playingFile.id}");
`;
document.body.style.opacity = 0.88;
return () => {
html.style = retStyle;
document.body.style = bodyRetStyle;
};
}, [playingFile.id]);
// select language
useEffect(() => {
const browserCode = window.navigator.language;
@@ -40,7 +61,7 @@ function App() {
}
}
// fallback to english
setLangCode('en-US');
setLangCode("en-US");
}, []);
return (