From dbbaf4fe509b300ac49ad7afd7111339c20e3208 Mon Sep 17 00:00:00 2001 From: leandrofars Date: Thu, 5 Sep 2024 12:24:21 -0300 Subject: [PATCH] feat(frontend): new colors palette --- frontend/src/theme/create-palette.js | 48 ++++++---------------------- 1 file changed, 9 insertions(+), 39 deletions(-) diff --git a/frontend/src/theme/create-palette.js b/frontend/src/theme/create-palette.js index 104de92..cf8bbef 100644 --- a/frontend/src/theme/create-palette.js +++ b/frontend/src/theme/create-palette.js @@ -2,50 +2,20 @@ import { common } from '@mui/material/colors'; import { alpha } from '@mui/material/styles'; import { error, indigo, info, neutral, success, warning, graphics } from './colors'; -const getColorScheme = async () => { - - let result = await fetch('/custom-frontend/colors').catch((error) => { - console.log('Error fetching colors'); - sessionStorage.setItem('colors', JSON.stringify({ - "buttons": "#306d6f", - "sidebar_end": "#306d6f", - "sidebar_initial": "#306d6f", - "tables": "#306d6f", - "words_outside_sidebar": "#30596f", - "connected_mtps_color": "#f28950" - })); - location.reload(); - return +const getColorScheme = () => { + return JSON.stringify({ + "buttons": "#c05521", + "sidebar_end": "#305a85", + "sidebar_initial": "#173033", + "tables": "#214256", + "words_outside_sidebar": "#173033", + "connected_mtps_color": "#c05521" }); - if (result.status!=200) { - console.log('Error fetching colors'); - sessionStorage.setItem('colors', JSON.stringify({ - "buttons": "#306d6f", - "sidebar_end": "#306d6f", - "sidebar_initial": "#306d6f", - "tables": "#306d6f", - "words_outside_sidebar": "#30596f", - "connected_mtps_color": "#f28950" - })); - location.reload(); - return - } - - let response = await result.json(); - let fmtresponse = JSON.stringify(response); - sessionStorage.setItem('colors', fmtresponse); - location.reload(); } export function createPalette() { - let colors = sessionStorage.getItem('colors'); - - if (colors !== null) { - console.log('colors already fetched'); - } else { - getColorScheme(); - } + let colors = getColorScheme(); console.log("colors scheme:", colors); let neutralColors = neutral(colors);