From 77f0c2f06f9c52e0520664c3134bdf54c4f7b998 Mon Sep 17 00:00:00 2001 From: mathysPaul Date: Fri, 27 Oct 2023 20:50:05 +0200 Subject: [PATCH] [add]: LinkBase && PopupCC, starting theme management (light and dark) and translation --- front/Theme.tsx | 29 + front/components/GtkUI/Element.tsx | 15 +- front/components/GtkUI/ElementTypes.tsx | 5 +- front/components/ScoreGraph.tsx | 711 +----------------- front/components/UI/ButtonBase.tsx | 13 +- front/components/UI/ButtonMenuBase.tsx | 161 ++++ front/components/UI/CheckboxBase.tsx | 69 +- front/components/UI/Glassmorphism.tsx | 2 +- front/components/UI/InteractiveBase.tsx | 7 +- front/components/UI/LinkBase.tsx | 99 ++- front/components/UI/PopupCC.tsx | 20 +- front/components/UI/Scaffold.tsx | 28 +- front/components/UI/ScaffoldAuth.tsx | 44 +- front/components/UI/ScaffoldCC.tsx | 58 +- front/components/UI/ScaffoldDesktopCC.tsx | 288 ++++--- front/components/UI/ScaffoldMobileCC.tsx | 110 ++- front/components/UI/SeparatorBase.tsx | 26 +- front/components/UI/SettingsBase.tsx | 15 +- front/components/UI/TextFieldBase.tsx | 17 +- front/i18n/Translations.ts | 36 + front/package.json | 2 +- front/views/ProfileView.tsx | 8 +- front/views/SigninView.tsx | 19 +- front/views/SignupView.tsx | 8 +- front/views/V2/DiscoveryView.tsx | 1 - .../views/settings/NotificationsSettings.tsx | 11 +- front/views/settings/PreferencesSettings.tsx | 13 +- front/views/settings/PrivacySettings.tsx | 9 +- front/views/settings/SettingsPremium.tsx | 9 +- front/views/settings/SettingsProfile.tsx | 14 +- front/views/settings/SettingsView.tsx | 24 +- front/yarn.lock | 19 +- 32 files changed, 739 insertions(+), 1151 deletions(-) create mode 100644 front/components/UI/ButtonMenuBase.tsx diff --git a/front/Theme.tsx b/front/Theme.tsx index 27cf7fe..fbfd9cf 100644 --- a/front/Theme.tsx +++ b/front/Theme.tsx @@ -4,6 +4,34 @@ import { useEffect } from 'react'; const ThemeProvider = ({ children }: { children: JSX.Element }) => { const colorScheme = useColorScheme(); + const lightGlassmorphism = { + 50: 'rgba(255,255,255,0.05)', + 100: 'rgba(255,255,255,0.1)', + 200: 'rgba(255,255,255,0.2)', + 300: 'rgba(255,255,255,0.3)', + 400: 'rgba(255,255,255,0.4)', + 500: 'rgba(255,255,255,0.5)', + 600: 'rgba(255,255,255,0.6)', + 700: 'rgba(255,255,255,0.7)', + 800: 'rgba(255,255,255,0.8)', + 900: 'rgba(255,255,255,0.9)', + }; + const darkGlassmorphism = { + 50: 'rgba(16,16,20,0.05)', + 100: 'rgba(16,16,20,0.1)', + 200: 'rgba(16,16,20,0.2)', + 300: 'rgba(16,16,20,0.3)', + 400: 'rgba(16,16,20,0.4)', + 500: 'rgba(16,16,20,0.5)', + 600: 'rgba(16,16,20,0.6)', + 700: 'rgba(16,16,20,0.7)', + 800: 'rgba(16,16,20,0.8)', + 900: 'rgba(16,16,20,0.9)', + }; + + const glassmorphism = colorScheme === 'light' + ? lightGlassmorphism + : darkGlassmorphism return ( { 800: '#6b2124', 900: '#531a1c', }, + coolGray: glassmorphism, }, components: { Button: { diff --git a/front/components/GtkUI/Element.tsx b/front/components/GtkUI/Element.tsx index 3931438..9ae5882 100644 --- a/front/components/GtkUI/Element.tsx +++ b/front/components/GtkUI/Element.tsx @@ -1,13 +1,14 @@ import React, { useState } from 'react'; import { ElementProps } from './ElementTypes'; import { RawElement } from './RawElement'; -import { View, Column } from 'native-base'; +import { View, Column, useTheme } from 'native-base'; import { StyleSheet } from 'react-native'; import InteractiveBase from '../UI/InteractiveBase'; export const Element = (props: T) => { let actionFunction: (() => void) | null | undefined = null; const [dropdownValue, setDropdownValue] = useState(false); + const { colors } = useTheme(); switch (props.type) { case 'text': @@ -32,28 +33,28 @@ export const Element = (props: T) => { shadowOpacity: 0, shadowRadius: 0, elevation: 0, - backgroundColor: 'rgba(16, 16, 20, 0.50)', + backgroundColor: colors.coolGray[500], }, onHover: { scale: 1, shadowOpacity: 0, shadowRadius: 0, elevation: 0, - backgroundColor: 'rgba(32, 32, 40, 0.50)', + backgroundColor: colors.coolGray[700], }, onPressed: { scale: 1, shadowOpacity: 0, shadowRadius: 0, elevation: 0, - backgroundColor: 'rgba(16, 16, 20, 0.50)', + backgroundColor: colors.coolGray[500], }, Disabled: { scale: 1, shadowOpacity: 0, shadowRadius: 0, elevation: 0, - backgroundColor: 'rgba(16, 16, 20, 0.50)', + backgroundColor: colors.coolGray[500], }, }); @@ -70,7 +71,7 @@ export const Element = (props: T) => { {props.type === 'sectionDropdown' && dropdownValue && ( - + {props.data.section.map((value, index) => ( (props: T) => { ); } return ( - + ); diff --git a/front/components/GtkUI/ElementTypes.tsx b/front/components/GtkUI/ElementTypes.tsx index 7ed5e74..b10e1d8 100644 --- a/front/components/GtkUI/ElementTypes.tsx +++ b/front/components/GtkUI/ElementTypes.tsx @@ -1,4 +1,4 @@ -import { Select, Switch, Text, Icon, Row, Slider } from 'native-base'; +import { Select, Switch, Text, Icon, Row, Slider, useTheme } from 'native-base'; import { MaterialIcons } from '@expo/vector-icons'; import { useWindowDimensions } from 'react-native'; @@ -101,12 +101,13 @@ export const getElementDropdownNode = ( disabled: boolean ) => { const layout = useWindowDimensions(); + const { colors } = useTheme(); return ( setSelectedSong(songs.data.find(song => selectedValue === song.name)?.id)} defaultValue={songs.data.at(0)?.name} - bgColor={'rgba(16,16,20,0.5)'} + bgColor={colors.coolGray[500]} variant="filled" width={layout.width > 650 ? '200' : '150'} > @@ -887,7 +184,7 @@ const ScoreGraph = () => {