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-1031] Add theme for n12 #1037

Merged
merged 7 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified src/assets/n12Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/atoms/AppBar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
import MatAppBar from '@material-ui/core/AppBar';
import { createStyles, makeStyles, Theme } from '@material-ui/core';
import { smokeWhiteColor } from 'style/default/_defaultColors';
import { smokeWhiteColor } from 'style';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Link as RouterLink, LinkProps } from 'react-router-dom';
import { oceanBlueColor, skyBlueColor } from 'style/default/_defaultColors';
import { oceanBlueColor, skyBlueColor } from 'style';

const useStyles = makeStyles({
link: {
Expand Down
3 changes: 1 addition & 2 deletions src/components/atoms/MostSevereAccidentsMarker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { AnyWayButton } from './AnyWayButton';
import { Typography, MapIcon, TooltipMarker, TooltipArrow } from '.';
import { ClockPosition } from 'models/ClockPosition';
import { useTranslation } from 'react-i18next';
import { defaultBorderRadius } from 'style';
import { silverSmokeColor } from 'style/default/_defaultColors';
import { silverSmokeColor, defaultBorderRadius } from 'style';
import { useLocale } from 'hooks/date.hooks'

interface IProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/ApproveLocationRadioButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {FormControl, FormControlLabel, makeStyles, Radio, RadioGroup} from "@mat
import React, {FC} from "react";
import {useTranslation} from "react-i18next";
import {ReactComponent as CheckCircleIcon} from "assets/check_blue_24dp.svg";
import {oceanBlueColor, roseColor, silverGrayColor} from "style/default/_defaultColors";
import {oceanBlueColor, roseColor, silverGrayColor} from "style";
import {ReactComponent as CancelCircleIcon} from "assets/cancel_red_24dp.svg";


Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/BarChartView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { FC } from 'react';
import { ResponsiveContainer, BarChart, LabelList, XAxis, Bar } from 'recharts';
import { roseColor } from 'style/default/_defaultColors';
import { roseColor } from 'style';
import { Typography } from 'components/atoms';
interface IProps {
data: Array<object>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/DialogWithHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { FC } from 'react';
import { Dialog, Typography } from 'components/atoms';
import { Box, makeStyles, createStyles, Theme, IconButton, DialogTitle, DialogContent } from '@material-ui/core';
import CloseIcon from '@material-ui/icons/Close';
import { shadowColor, blueVioletColor } from 'style/default/_defaultColors';
import { shadowColor, blueVioletColor } from 'style';

interface IProps {
title: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/DoubleBarChartView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { FC } from 'react';
import { ResponsiveContainer, BarChart, LabelList, XAxis, Bar } from 'recharts';
import { roseColor, honeyColor } from 'style/default/_defaultColors';
import { roseColor, honeyColor } from 'style';

interface IProps {
data: Array<object>;
Expand Down
3 changes: 1 addition & 2 deletions src/components/molecules/GenericBarChart.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { FC } from 'react';
import { ResponsiveContainer, BarChart, LabelList, XAxis, Bar, Tooltip, Legend } from 'recharts';
import {blackColor, ColorScheme, whiteColor} from 'style';
import { roseColor } from 'style/default/_defaultColors';
import {roseColor, blackColor, ColorScheme, whiteColor} from 'style';
import tinycolor from 'tinycolor2';
import {useTheme} from "@material-ui/core/styles";

Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/LocationSearchIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';

import Box from '@material-ui/core/Box';
import { Typography } from 'components/atoms';
import { oceanBlueColor, secondaryBgColor } from 'style/default/_defaultColors';
import { oceanBlueColor, secondaryBgColor } from 'style';

const useStyles = makeStyles({
root: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/LogInLinkGoogle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { makeStyles } from '@material-ui/core/styles';
import { oceanBlueColor, skyBlueColor } from 'style/default/_defaultColors';
import { oceanBlueColor, skyBlueColor } from 'style';
import React from 'react';
import { AUTH_LOGIN_GOOGLE_URL } from 'const/generalConst';
import { openSignInWindow } from 'services/signInWindow';
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/NewsFlashComp.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {FC, useState} from 'react';
import { Link, Typography, Button } from 'components/atoms';
import { Box, makeStyles } from '@material-ui/core';
import { cherryJamColor, oceanBlueColor, silverSmokeColor } from 'style/default/_defaultColors';
import { cherryJamColor, oceanBlueColor, silverSmokeColor } from 'style';
import { useStore } from 'store/storeConfig';
import RootStore from 'store/root.store';
import { dateFormat } from 'utils/time.utils';
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/NewsFlashFilterPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
import classnames from 'classnames';
import { Box, makeStyles } from '@material-ui/core';
import { silverSmokeColor, oceanBlueColor } from 'style/default/_defaultColors';
import { silverSmokeColor, oceanBlueColor } from 'style';
import ynetLogo from 'assets/ynet-website-logo.svg';
import wallaLogo from 'assets/walla-logo.svg';
import madaLogo from 'assets/mada-logo.svg';
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/OverlayLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { FC } from 'react';
import Loader from 'components/atoms/Loader';
import Box from '@material-ui/core/Box';
import { makeStyles } from '@material-ui/core';
import { silverSmokeColor } from 'style/default/_defaultColors';
import { silverSmokeColor } from 'style';

const useStyles = makeStyles({
root: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/StackedBarChartView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { FC } from 'react';
import { ResponsiveContainer, BarChart, XAxis, Bar, Legend } from 'recharts';
import { roseColor, honeyColor, yellowColor } from 'style/default/_defaultColors';
import { roseColor, honeyColor, yellowColor } from 'style';

interface IProps {
data: Array<object>;
Expand Down
3 changes: 1 addition & 2 deletions src/components/molecules/Table/TableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React, { FC } from 'react';
import { makeStyles, withStyles, createStyles } from '@material-ui/core/styles';
import { Typography } from 'components/atoms';
import { Table, TableBody, TableCell, TableHead, TableRow, Theme } from '@material-ui/core';
import { blackColor } from 'style';
import { silverGrayColor } from 'style/default/_defaultColors'
import { silverGrayColor, blackColor } from 'style';
import { ITableData } from './formatTableData.service';

interface IProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/TextView/TextView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
import { IWidgetCountBySeverityTextDataBase } from 'models/WidgetData';
import { makeStyles } from '@material-ui/core';
import { brightGreyColor } from 'style/default/_defaultColors';
import { brightGreyColor } from 'style';
import Box from '@material-ui/core/Box';
import classNames from 'classnames';
import TextViewList from './TextViewList';
Expand Down
3 changes: 1 addition & 2 deletions src/components/molecules/TextView/TextViewRecord.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import Box from '@material-ui/core/Box';
import { roadIconColors } from 'style';
import { silverSmokeColor } from 'style/default/_defaultColors';
import { roadIconColors, silverSmokeColor } from 'style';
import SeverityImage from './SeverityImage';
import { makeStyles } from '@material-ui/core/styles';
import { Typography } from 'components/atoms';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import Box from '@material-ui/core/Box';
import { roadIconColors } from 'style';
import { silverSmokeColor } from 'style/default/_defaultColors';
import { roadIconColors, silverSmokeColor } from 'style';
import SeverityImage from './SeverityImage';
import { makeStyles } from '@material-ui/core/styles';
import { Typography , CustomTypography} from 'components/atoms';
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/UserProfileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import UserInfoForm, { IFormInput } from './UserUpdateForm';
import AdminManagementForm from './adminManagement/AdminManagementForm';
import { useTranslation } from 'react-i18next';
import makeStyles from '@material-ui/core/styles/makeStyles';
import { oceanBlueColor, skyBlueColor } from 'style/default/_defaultColors';
import { oceanBlueColor, skyBlueColor } from 'style';
import Box from '@material-ui/core/Box';
import { Avatar } from '@material-ui/core';
import { IAnywayUserDetails } from 'services/user.service';
Expand Down
6 changes: 3 additions & 3 deletions src/components/molecules/card/AnyWayCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { FC, useState } from 'react';
import {ColorScheme} from 'style/_colors'
import {ColorScheme} from 'style'
import { Card, CardContent, Box } from '@material-ui/core';
import {makeStyles} from '@material-ui/core/styles';
import widgetToImage from 'services/to-image.service';
Expand Down Expand Up @@ -94,7 +94,7 @@ const AnyWayCard: FC<IProps> = ({
const [isOpen, setOpen] = useState(false);
const [widgateOpen,SetWidgetOpen] = useState('')

const handleCardEditorOpen = (name:string) =>{
const handleCardEditorOpen = (name:string) =>{
SetWidgetOpen(name)
setOpen(true)
};
Expand All @@ -117,7 +117,7 @@ const AnyWayCard: FC<IProps> = ({

case 'TextBox':
Widget = <TextBox isOpen={isOpen} onClose={handleCardEditorClose} widgetName={widgetName} text={transcription} />
break
break
case 'CardEditor':
Widget = <CardEditor isOpen={isOpen} onClose={handleCardEditorClose} widgetName={widgetName} text={title} />
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/molecules/card/CardHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import RoadNumberImage from './RoadNumberImage';
import LamasImage from 'assets/cbs.png';
import AnywayImage from 'assets/anyway.png';
import { Typography, Logo } from 'components/atoms';
import {ColorScheme, opacity80percent} from 'style/';
import {silverSmokeColor} from "style/default/_defaultColors";
import {ColorScheme, opacity80percent, silverSmokeColor} from 'style/';

const useStyles = makeStyles((theme) => ({
wrapper: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Typography } from 'components/atoms';
import PieChartView, { renderCollisionCustomizedLabel } from '../PieChartView';
import { IWidgetHeadOnCollisionsComparisonData } from 'models/WidgetData';
import { Box, makeStyles } from '@material-ui/core';
import { cherryJamColor, silverSpoonColor } from 'style/default/_defaultColors';
import { cherryJamColor, silverSpoonColor } from 'style';
import { useTranslation } from 'react-i18next';
import RootStore from 'store/root.store';
import { useStore } from 'store/storeConfig';
Expand Down
2 changes: 1 addition & 1 deletion src/components/organisms/CardEditorDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AnyWayCard, { CardSizeOptions } from 'components/molecules/card/AnyWayCar
import { MetaTag, ErrorBoundary, Typography, Button, Slider } from 'components/atoms';
import widgetToImage from 'services/to-image.service';
import { useTranslation } from 'react-i18next';
import { blueVioletColor } from 'style/default/_defaultColors';
import { blueVioletColor } from 'style';

import {initEditorBarOptions, barsWidgetsLabels, barsWidgetsTitle, NUM_OF_BARS} from 'utils/barChart.utils';

Expand Down
2 changes: 1 addition & 1 deletion src/components/organisms/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import logoNatun from 'assets/NATUN-LOGO-FINAL-COLOR.png';
import { makeStyles } from '@material-ui/core/styles';
import { Box } from '@material-ui/core';
import { Typography } from 'components/atoms';
import { silverSmokeColor, oceanBlueColor, skyBlueColor } from 'style/default/_defaultColors';
import { silverSmokeColor, oceanBlueColor, skyBlueColor } from 'style';
import ThankYouDialog from './ThankYouDialog';
import AboutDialog from './AboutDialog';
import { version } from '../../../package.json'; // eslint-disable-line
Expand Down
2 changes: 1 addition & 1 deletion src/components/organisms/LocationApproveWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import DialogWithHeader from '../molecules/DialogWithHeader';
import {Box, makeStyles } from '@material-ui/core';
import { Button, Typography } from 'components/atoms';
import { useTranslation } from 'react-i18next';
import { silverSmokeColor } from 'style/default/_defaultColors';
import { silverSmokeColor } from 'style';
import { INewsFlash } from "models/NewFlash";
import { useStore } from "store/storeConfig";
import {IPoint} from "models/Point";
Expand Down
4 changes: 2 additions & 2 deletions src/components/organisms/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Box, makeStyles } from '@material-ui/core';
import News from './News';
import NewsFlashFilterPanel from 'components/molecules/NewsFlashFilterPanel';
import OverlayLoader from '../molecules/OverlayLoader';
import { silverSmokeColor } from 'style/default/_defaultColors';
import { silverSmokeColor } from 'style';
import { Typography, ErrorBoundary } from 'components/atoms';
import { observer } from 'mobx-react-lite';
import { useStore } from 'store/storeConfig';
Expand Down Expand Up @@ -62,7 +62,7 @@ const SideBar: FC<IProps> = () => {
{location && (
<ErrorBoundary>
<SideBarMap items={[location]} />
</ErrorBoundary>
</ErrorBoundary>
)}
</Box>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, FC } from 'react';
import { Box } from '@material-ui/core';
import SideBar from 'components/organisms/SideBar';
import makeStyles from '@material-ui/core/styles/makeStyles';
import { silverSmokeColor } from 'style/default/_defaultColors';
import { silverSmokeColor } from 'style';
import FilterBar from 'components/organisms/FilterBar';
import OverlayLoader from 'components/molecules/OverlayLoader';
import { observer } from 'mobx-react-lite';
Expand Down
23 changes: 14 additions & 9 deletions src/services/news.data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,24 @@ function onErrorFetchNewsFlash() {
}

export function updateNews(newsId: number, newLocationQualification: any,
streetLocation: IStreetData | null, gpsLocation: IGpsData | null) {
const data = [];
data.push(`newsflash_location_qualification=${newLocationQualification}`)
streetLocation: IStreetData | null, gpsLocation: IGpsData | null) {
const data : Record<string, string | undefined> = {}; // object to hold request data
data['newsflash_location_qualification'] = newLocationQualification;

if (gpsLocation) {
data.push(`road_segment_name=${gpsLocation.road_segment_name}`)
data.push(`road1=${gpsLocation.road1}`)
data['road_segment_name'] = gpsLocation.road_segment_name;
data['road1'] = gpsLocation.road1;
} else if (streetLocation) {
data.push(`yishuv_name=${streetLocation.city.yishuv_name}`)
data.push(`street1_hebrew=${streetLocation.street.street_hebrew}`)
data['yishuv_name'] = streetLocation.city.yishuv_name;
data['street1_hebrew'] = streetLocation.street.street_hebrew;
}
const url = `${NEWS_FLASH_API}/${newsId}?${data.join('&')}`;
const url = `${NEWS_FLASH_API}/${newsId}`;
axios
.patch(url)
.patch(url, data, {
headers: {
'Content-Type': 'application/json',
},
})
.then((res) => res.data)
.catch(onErrorFetchNewsFlash)
}
29 changes: 14 additions & 15 deletions src/store/settings.store.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { makeAutoObservable, runInAction } from 'mobx';
import { Theme, createMuiTheme } from '@material-ui/core';
import { defaultThemeOptions } from 'style';
import { LANG } from 'const/languages.const';
import {makeAutoObservable, runInAction} from 'mobx';
import {createMuiTheme, Theme} from '@material-ui/core';
import {defaultThemeOptions} from 'style';
import {LANG} from 'const/languages.const';
import i18next from 'services/i18n.service';
import RootStore from './root.store';
import {themeOptions} from "../style/theme";
import {ThemeData, ThemeNames, themeOptions} from "style/theme";

export default class SettingsStore {
rootStore: RootStore;
private themeName = 'default';
_theme: Theme = createMuiTheme(defaultThemeOptions);
private themeName : ThemeNames = ThemeNames.DEFAULT;
_theme : Theme = createMuiTheme(defaultThemeOptions);
currentLanguageRouteString: string = '';
selectedLanguage: string = LANG.HE;

Expand All @@ -19,15 +19,14 @@ export default class SettingsStore {
}

get theme(): Theme {
return this._theme;
}

changeTheme(newThemeName: string) {
const newThemeOption = themeOptions.find((p) => p.key === newThemeName);
if (newThemeOption) {
this.themeName = newThemeName;
this._theme = createMuiTheme(newThemeOption.theme);
let new_theme : Theme | undefined = undefined;
const organizationName = this.rootStore.userStore.orgNamesList ? this.rootStore.userStore.orgNamesList[0] : '';
if (organizationName) {
const new_theme_data : ThemeData | undefined = themeOptions.find((p) => p.key === this.themeName);
new_theme = new_theme_data?.theme;
}
this._theme = new_theme ? new_theme : this._theme;
return this._theme;
}

changeLanguage(lngCode: string): void {
Expand Down
2 changes: 0 additions & 2 deletions src/style/_colors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// import { PaletteColorOptions } from "@material-ui/core";

import {barColors, blueVioletColor, pieChartColors, silverGrayColor} from "./default/_defaultColors";
import {
grayBeige,
Expand Down
3 changes: 1 addition & 2 deletions src/style/default/defaultTheme.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ThemeOptions } from '@material-ui/core';
import { ColorScheme, defaultThemeColors, fontFamilyString } from 'style';
import { darkGrey } from 'style/default/_defaultColors'
import { darkGrey, defaultThemeColors, fontFamilyString } from 'style';

const defaultThemeOptions: ThemeOptions = {
palette: {
Expand Down
1 change: 1 addition & 0 deletions src/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './_fonts';
export * from './_colors';
export * from './default/_defaultColors';
export * from './_sizes';
export { defaultThemeOptions } from './default/defaultTheme';
export { n12ThemeOptions } from './n12/n12Theme';
17 changes: 10 additions & 7 deletions src/style/theme.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import {n12ThemeOptions} from "./n12/n12Theme";
import {defaultThemeOptions} from "./default/defaultTheme";
import { ThemeOptions } from "@material-ui/core";
import {defaultThemeOptions, n12ThemeOptions} from "style";
import {createMuiTheme, Theme} from "@material-ui/core";

export type ThemeData = {key : string, theme : ThemeOptions} ;
export enum ThemeNames {
DEFAULT= 'default',
N12 = 'n12',
}

export type ThemeData = {key : ThemeNames, theme : Theme} ;

export const themeOptions : ThemeData[] = [
// {key: 'or_yarok', path: orYarokTheme},
{key: 'default', theme: defaultThemeOptions},
{key: 'n12', theme: n12ThemeOptions},
{key: ThemeNames.DEFAULT, theme: createMuiTheme(defaultThemeOptions)},
{key: ThemeNames.N12, theme: createMuiTheme(n12ThemeOptions)},
]
Loading