Add preferred theme colors to footer (#155)

* Add preferred theme colors to footer

* remove inline-block

* Add Footer to LoginPage

* update README, add new screenshot, update Footer
This commit is contained in:
Borislav Pantaleev 2024-11-19 11:14:06 +02:00 committed by GitHub
parent 86d0fd04e6
commit befcd15298
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 38 additions and 22 deletions

View file

@ -12,7 +12,8 @@
--- ---
![Screenshots](./screenshots.jpg) ![Login form](./screenshots/auth.webp)
![Screenshots](./screenshots/screenshots.jpg)
This project is built using [react-admin](https://marmelab.com/react-admin/). This project is built using [react-admin](https://marmelab.com/react-admin/).
@ -94,6 +95,7 @@ with a proper manifest.json generation on build)
* [Support configuration via /.well-known/matrix/client](https://github.com/etkecc/synapse-admin/pull/126) * [Support configuration via /.well-known/matrix/client](https://github.com/etkecc/synapse-admin/pull/126)
* [Prevent accidental user overwrites](https://github.com/etkecc/synapse-admin/pull/139) * [Prevent accidental user overwrites](https://github.com/etkecc/synapse-admin/pull/139)
* [Allow providing login form details via GET params](https://github.com/etkecc/synapse-admin/pull/140) * [Allow providing login form details via GET params](https://github.com/etkecc/synapse-admin/pull/140)
* [Add preferred theme colors to login page and footer](https://github.com/etkecc/synapse-admin/pull/155)
_the list will be updated as new changes are added_ _the list will be updated as new changes are added_

BIN
screenshots/auth.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

View file

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 222 KiB

View file

@ -23,7 +23,6 @@ import users from "./resources/users";
import authProvider from "./synapse/authProvider"; import authProvider from "./synapse/authProvider";
import dataProvider from "./synapse/dataProvider"; import dataProvider from "./synapse/dataProvider";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import Footer from "./components/Footer";
// TODO: Can we use lazy loading together with browser locale? // TODO: Can we use lazy loading together with browser locale?
const messages = { const messages = {
@ -82,7 +81,6 @@ const App = () => (
<Resource name="room_state" /> <Resource name="room_state" />
<Resource name="destination_rooms" /> <Resource name="destination_rooms" />
</Admin> </Admin>
<Footer />
</QueryClientProvider> </QueryClientProvider>
); );

View file

@ -3,6 +3,7 @@ import { LoginMethod } from "../pages/LoginPage";
import { useEffect, useState, Suspense } from "react"; import { useEffect, useState, Suspense } from "react";
import { Icons, DefaultIcon } from "./icons"; import { Icons, DefaultIcon } from "./icons";
import { ClearConfig } from "./config"; import { ClearConfig } from "./config";
import Footer from "./Footer";
const AdminUserMenu = () => { const AdminUserMenu = () => {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
@ -88,8 +89,9 @@ const AdminMenu = (props) => {
); );
}; };
export const AdminLayout = ({ children }) => ( export const AdminLayout = ({ children }) => {
<Layout appBar={AdminAppBar} menu={AdminMenu} sx={{ return <>
<Layout appBar={AdminAppBar} menu={AdminMenu} sx={{
['& .RaLayout-appFrame']: { ['& .RaLayout-appFrame']: {
minHeight: '90vh', minHeight: '90vh',
height: '90vh', height: '90vh',
@ -98,7 +100,9 @@ export const AdminLayout = ({ children }) => (
marginBottom: '3rem', marginBottom: '3rem',
}, },
}}> }}>
{children} {children}
<CheckForApplicationUpdate /> <CheckForApplicationUpdate />
</Layout> </Layout>
); <Footer />
</>
};

View file

@ -1,8 +1,11 @@
import { Avatar, Box, Link, Typography } from "@mui/material"; import { Avatar, Box, Link, Typography } from "@mui/material";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useTheme } from "@mui/material/styles";
const Footer = () => { const Footer = () => {
const [version, setVersion] = useState<string | null>(null); const [version, setVersion] = useState<string | null>(null);
const theme = useTheme();
useEffect(() => { useEffect(() => {
const version = document.getElementById("js-version")?.textContent; const version = document.getElementById("js-version")?.textContent;
if (version) { if (version) {
@ -10,6 +13,8 @@ const Footer = () => {
} }
}, []); }, []);
console.log(theme);
return (<Box return (<Box
component="footer" component="footer"
sx={{ sx={{
@ -17,23 +22,28 @@ const Footer = () => {
zIndex: 100, zIndex: 100,
bottom: 0, bottom: 0,
width: '100%', width: '100%',
bgcolor: "#eee", bgcolor: theme.palette.background.default,
color: theme.palette.text.primary,
borderTop: '1px solid', borderTop: '1px solid',
borderColor: '#ddd', borderColor: theme.palette.divider,
fontSize: '0.89rem',
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'start',
p: 1, p: 1,
gap: '10px'
}}> }}>
<Typography variant="body2" component="div">
<Avatar src="./images/logo.webp" sx={{ width: "1rem", height: "1rem", display: "inline-block", verticalAlign: "sub" }} /> <Avatar src="./images/logo.webp" sx={{ width: "1rem", height: "1rem", display: "inline-block", verticalAlign: "sub" }} />
<Link sx={{ color: "#888", textDecoration: 'none' }} href="https://github.com/etkecc/synapse-admin" target="_blank"> <Link href="https://github.com/etkecc/synapse-admin" target="_blank">
Synapse Admin Synapse Admin {version}
</Link> <Link href={`https://github.com/etkecc/synapse-admin/releases/tag/`+version} target="_blank"> </Link>
<span style={{ fontWeight: 'bold', color: "#000" }}>{version}</span> by
</Link> <Link sx={{ color: "#888", textDecoration: 'none' }} href="https://etke.cc/?utm_source=synapse-admin&utm_medium=footer&utm_campaign=synapse-admin" target="_blank"> <Link href="https://etke.cc/?utm_source=synapse-admin&utm_medium=footer&utm_campaign=synapse-admin" target="_blank">
by etke.cc etke.cc
</Link> <Link sx={{ color: "#888", textDecoration: 'none' }} href="https://github.com/awesome-technologies/synapse-admin" target="_blank"> </Link>
(originally developed by Awesome Technologies Innovationslabor GmbH). (originally developed by Awesome Technologies Innovationslabor GmbH).
</Link> <Link sx={{ fontWeight: 'bold', color: "#000", textDecoration: 'none' }} href="https://matrix.to/#/#synapse-admin:etke.cc" target="_blank">#synapse-admin:etke.cc</Link> <Link sx={{ fontWeight: 'bold' }} href="https://matrix.to/#/#synapse-admin:etke.cc" target="_blank">#synapse-admin:etke.cc</Link>
</Typography>
</Box> </Box>
); );
}; };

View file

@ -26,6 +26,7 @@ import {
splitMxid, splitMxid,
} from "../synapse/synapse"; } from "../synapse/synapse";
import storage from "../storage"; import storage from "../storage";
import Footer from "../components/Footer";
export type LoginMethod = "credentials" | "accessToken"; export type LoginMethod = "credentials" | "accessToken";
@ -321,6 +322,7 @@ const LoginPage = () => {
</Card> </Card>
</LoginFormBox> </LoginFormBox>
<Notification /> <Notification />
<Footer />
</Form> </Form>
); );
}; };