Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Custom header and footer. Move settings to its own page #17

Merged
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,7 @@ Now you can start the server and check if every visualization is working properl
### Storage

Settings can be saved in the data store (default) or as constants. Use the env variable **REACT_APP_STORAGE** to select which one to use (`datastore` or `constants`).

### Custom Header and Footer

The header and footer can be configured in `src/app-config.ts`. They can be disabled by setting their values to `false`.
15 changes: 9 additions & 6 deletions i18n/ar.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-12-16T17:57:18.316Z\n"
"POT-Creation-Date: 2024-12-31T16:17:51.096Z\n"
"PO-Revision-Date: 2018-10-25T09:02:35.143Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand All @@ -26,19 +26,16 @@ msgstr ""
msgid "Export to Word"
msgstr ""

msgid "App Settings"
msgstr ""

msgid "Font Size"
msgstr ""

msgid "Show/Hide Feedback"
msgstr ""

msgid "Save"
msgid "Cancel"
msgstr ""

msgid "Close"
msgid "Save"
msgstr ""

msgid "Back"
Expand All @@ -53,6 +50,9 @@ msgstr ""
msgid "Templates not found"
msgstr ""

msgid "Settings saved"
msgstr ""

msgid "Distributed under GNU GLPv3"
msgstr ""

Expand Down Expand Up @@ -81,3 +81,6 @@ msgstr ""

msgid "EyeSeeTea"
msgstr ""

msgid "App Settings"
msgstr ""
17 changes: 10 additions & 7 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-12-16T17:57:18.316Z\n"
"PO-Revision-Date: 2024-12-16T17:57:18.316Z\n"
"POT-Creation-Date: 2024-12-31T16:17:51.096Z\n"
"PO-Revision-Date: 2024-12-31T16:17:51.096Z\n"

msgid "Select Dashboard"
msgstr ""
Expand All @@ -26,19 +26,16 @@ msgstr ""
msgid "Export to Word"
msgstr ""

msgid "App Settings"
msgstr ""

msgid "Font Size"
msgstr ""

msgid "Show/Hide Feedback"
msgstr ""

msgid "Save"
msgid "Cancel"
msgstr ""

msgid "Close"
msgid "Save"
msgstr ""

msgid "Back"
Expand All @@ -53,6 +50,9 @@ msgstr ""
msgid "Templates not found"
msgstr ""

msgid "Settings saved"
msgstr ""

msgid "Distributed under GNU GLPv3"
msgstr ""

Expand Down Expand Up @@ -81,3 +81,6 @@ msgstr ""

msgid "EyeSeeTea"
msgstr ""

msgid "App Settings"
msgstr ""
15 changes: 9 additions & 6 deletions i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-12-16T17:57:18.316Z\n"
"POT-Creation-Date: 2024-12-31T16:17:51.096Z\n"
"PO-Revision-Date: 2018-10-25T09:02:35.143Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand All @@ -26,19 +26,16 @@ msgstr ""
msgid "Export to Word"
msgstr ""

msgid "App Settings"
msgstr ""

msgid "Font Size"
msgstr ""

msgid "Show/Hide Feedback"
msgstr ""

msgid "Save"
msgid "Cancel"
msgstr ""

msgid "Close"
msgid "Save"
msgstr ""

msgid "Back"
Expand All @@ -53,6 +50,9 @@ msgstr ""
msgid "Templates not found"
msgstr ""

msgid "Settings saved"
msgstr ""

msgid "Distributed under GNU GLPv3"
msgstr ""

Expand Down Expand Up @@ -82,6 +82,9 @@ msgstr ""
msgid "EyeSeeTea"
msgstr ""

msgid "App Settings"
msgstr ""

#~ msgid "Add"
#~ msgstr "Añadir"

Expand Down
15 changes: 9 additions & 6 deletions i18n/fr.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-12-16T17:57:18.316Z\n"
"POT-Creation-Date: 2024-12-31T16:17:51.096Z\n"
"PO-Revision-Date: 2018-10-25T09:02:35.143Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand All @@ -26,19 +26,16 @@ msgstr ""
msgid "Export to Word"
msgstr ""

msgid "App Settings"
msgstr ""

msgid "Font Size"
msgstr ""

msgid "Show/Hide Feedback"
msgstr ""

msgid "Save"
msgid "Cancel"
msgstr ""

msgid "Close"
msgid "Save"
msgstr ""

msgid "Back"
Expand All @@ -53,6 +50,9 @@ msgstr ""
msgid "Templates not found"
msgstr ""

msgid "Settings saved"
msgstr ""

msgid "Distributed under GNU GLPv3"
msgstr ""

Expand Down Expand Up @@ -81,3 +81,6 @@ msgstr ""

msgid "EyeSeeTea"
msgstr ""

msgid "App Settings"
msgstr ""
15 changes: 9 additions & 6 deletions i18n/pt.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-12-16T17:57:18.316Z\n"
"POT-Creation-Date: 2024-12-31T16:17:51.096Z\n"
"PO-Revision-Date: 2018-10-25T09:02:35.143Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand All @@ -26,19 +26,16 @@ msgstr ""
msgid "Export to Word"
msgstr ""

msgid "App Settings"
msgstr ""

msgid "Font Size"
msgstr ""

msgid "Show/Hide Feedback"
msgstr ""

msgid "Save"
msgid "Cancel"
msgstr ""

msgid "Close"
msgid "Save"
msgstr ""

msgid "Back"
Expand All @@ -53,6 +50,9 @@ msgstr ""
msgid "Templates not found"
msgstr ""

msgid "Settings saved"
msgstr ""

msgid "Distributed under GNU GLPv3"
msgstr ""

Expand Down Expand Up @@ -81,3 +81,6 @@ msgstr ""

msgid "EyeSeeTea"
msgstr ""

msgid "App Settings"
msgstr ""
28 changes: 28 additions & 0 deletions src/app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,40 @@ export const appConfig: AppConfig = {
buttonPosition: "bottom-end",
},
},
header: false,
footer: false,
// header: {
MatiasArriola marked this conversation as resolved.
Show resolved Hide resolved
// title: "Dashboard Reports - Custom Header Title",
// background: "rgba(19,52,59,1)",
// color: "white",
// },
// footer: {
// text: `Dashboard Reports - Custom Footer.
// Multi-line text is allowed.
// TBD: More customization options.
// `,
// background: "linear-gradient(90deg, rgba(31,41,30,1) 0%, rgba(20,50,28,1) 50%, rgba(31,41,30,1) 100%)",
// color: "white",
// },
};

export interface HeaderOptions {
title: string;
background?: string;
color?: string;
}
export interface FooterOptions {
text: string;
background?: string;
color?: string;
}

export interface AppConfig {
appKey: string;
appearance: {
showShareButton: boolean;
};
feedback?: FeedbackOptions;
header: HeaderOptions | false;
footer: FooterOptions | false;
}
28 changes: 28 additions & 0 deletions src/webapp/components/custom-footer/CustomFooter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react";
import { Typography, Box, makeStyles } from "@material-ui/core";
import { FooterOptions } from "../../../app-config";

export type CustomFooterProps = FooterOptions;

type StyleProps = Omit<CustomFooterProps, "text">;

const useStyles = makeStyles(() => ({
container: (props: StyleProps) => ({
background: props.background ?? "inherit",
color: props.color ?? "inherit",
}),
text: {
whiteSpace: "pre-line",
},
}));

export const CustomFooter: React.FC<CustomFooterProps> = ({ text, ...styleProps }) => {
const classes = useStyles(styleProps);
return (
<Box component="footer" py={4} px={6} className={classes.container}>
<Typography variant="body2" className={classes.text}>
{text}
</Typography>
</Box>
);
};
34 changes: 34 additions & 0 deletions src/webapp/components/custom-header/CustomHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react";
import AppBar from "@material-ui/core/AppBar";
import Toolbar from "@material-ui/core/Toolbar";
import Typography from "@material-ui/core/Typography";
import { makeStyles } from "@material-ui/core/styles";
import { HeaderOptions } from "../../../app-config";

export type CustomHeaderProps = HeaderOptions;

type StyleProps = Omit<CustomHeaderProps, "title">;

const useStyles = makeStyles(() => ({
container: (props: StyleProps) => ({
background: props.background ?? "inherit",
color: props.color ?? "inherit",
}),
title: {
flexGrow: 1,
},
}));

export const CustomHeader: React.FC<CustomHeaderProps> = ({ title, ...styleProps }) => {
const classes = useStyles(styleProps);

return (
<AppBar position="static" className={classes.container} elevation={0}>
<Toolbar>
<Typography variant="h6" className={classes.title}>
{title}
</Typography>
</Toolbar>
</AppBar>
);
};
Loading
Loading