From c52ebffa36f592bdabdc02284d00bd57cf0a883e Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 18 Dec 2023 18:01:50 -0600 Subject: [PATCH] Rename for better diff --- src/Navigation.tsx | 2 +- src/view/screens/Debug.tsx | 701 ++++++++++++++++++++++++---------- src/view/screens/DebugNew.tsx | 219 +++++++++++ src/view/screens/DebugOld.tsx | 520 ------------------------- 4 files changed, 721 insertions(+), 721 deletions(-) create mode 100644 src/view/screens/DebugNew.tsx delete mode 100644 src/view/screens/DebugOld.tsx diff --git a/src/Navigation.tsx b/src/Navigation.tsx index c9f9272194..0a46041fb7 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -61,7 +61,7 @@ import {ProfileListScreen} from './view/screens/ProfileList' import {PostThreadScreen} from './view/screens/PostThread' import {PostLikedByScreen} from './view/screens/PostLikedBy' import {PostRepostedByScreen} from './view/screens/PostRepostedBy' -import {DebugScreen} from './view/screens/Debug' +import {DebugScreen} from './view/screens/DebugNew' import {LogScreen} from './view/screens/Log' import {SupportScreen} from './view/screens/Support' import {PrivacyPolicyScreen} from './view/screens/PrivacyPolicy' diff --git a/src/view/screens/Debug.tsx b/src/view/screens/Debug.tsx index da63c628bd..0e0464200e 100644 --- a/src/view/screens/Debug.tsx +++ b/src/view/screens/Debug.tsx @@ -1,219 +1,520 @@ import React from 'react' -import {View, Text as RNText} from 'react-native' -import {CenteredView, ScrollView} from '#/view/com/util/Views' +import {ScrollView, View} from 'react-native' +import {NativeStackScreenProps, CommonNavigatorParams} from 'lib/routes/types' +import {ViewHeader} from '../com/util/ViewHeader' +import {ThemeProvider, PaletteColorName} from 'lib/ThemeContext' +import {usePalette} from 'lib/hooks/usePalette' +import {s} from 'lib/styles' +import * as Toast from 'view/com/util/Toast' +import {Text} from '../com/util/text/Text' +import {ViewSelector} from '../com/util/ViewSelector' +import {EmptyState} from '../com/util/EmptyState' +import * as LoadingPlaceholder from '../com/util/LoadingPlaceholder' +import {Button, ButtonType} from '../com/util/forms/Button' +import {DropdownButton, DropdownItem} from '../com/util/forms/DropdownButton' +import {ToggleButton} from '../com/util/forms/ToggleButton' +import {RadioGroup} from '../com/util/forms/RadioGroup' +import {ErrorScreen} from '../com/util/error/ErrorScreen' +import {ErrorMessage} from '../com/util/error/ErrorMessage' -import {useSetColorMode} from '#/state/shell' -import { - useBreakpoints, - useStyle, - useStyles, - Box, - Text, - Button, - H1, - H2, - H3, - H4, - H5, - H6, -} from '#/view/nova' - -function ThemeSelector() { - const setColorMode = useSetColorMode() +const MAIN_VIEWS = ['Base', 'Controls', 'Error', 'Notifs'] +export const DebugScreen = ({}: NativeStackScreenProps< + CommonNavigatorParams, + 'Debug' +>) => { + const [colorScheme, setColorScheme] = React.useState<'light' | 'dark'>( + 'light', + ) + const onToggleColorScheme = () => { + setColorScheme(colorScheme === 'light' ? 'dark' : 'light') + } return ( - - - - - + + + ) } -function BreakpointDebugger() { - const breakpoints = useBreakpoints() +function DebugInner({ + colorScheme, + onToggleColorScheme, +}: { + colorScheme: 'light' | 'dark' + onToggleColorScheme: () => void +}) { + const [currentView, setCurrentView] = React.useState(0) + const pal = usePalette('default') + + const renderItem = (item: any) => { + return ( + + + + + {item.currentView === 3 ? ( + + ) : item.currentView === 2 ? ( + + ) : item.currentView === 1 ? ( + + ) : ( + + )} + + ) + } + + const items = [{currentView}] return ( - -

- Breakpoint Debugger -

- - {JSON.stringify(breakpoints, null, 2)} - -
- ) -} - -function Hooks() { - const outer = useStyle({ - pa: 'm', - bg: 'l1', - }) - const {heading} = useStyles({ - heading: { - color: 'l7', - fontSize: 'l', - fontWeight: 'bold', - gtTablet: { - fontSize: 'xl', - }, - }, - }) - - return ( - - Hooks + + + ) } -export function DebugScreen() { - const backgroundStyles = useStyle({ - bg: 'l0', - }) - +function Heading({label}: {label: string}) { + const pal = usePalette('default') return ( - - - - + + + {label} + + + ) +} - -

- Colors -

- - - - - - - - - - - +function BaseView() { + return ( + + + + + + + + + + + + + + + + ) +} - -

- Spacing -

- - - - xxs (2px) - - - - xs (4px) - - - - s (8px) - - - - m (12px) - - - - l (18px) - - - - xl (24px) - - - - xxl (32px) - - - - - - - - -

- Typography -

- - -

Heading 1

-

Heading 2

-

Heading 3

-

Heading 4

-
Heading 5
-
Heading 6
- - H1 Size Text - - H2 Size Text - H3 Size Text - H4 Size Text - H5 Size Text - H6 Size Text -
-
- - -

- Grid -

- - - - - - - - - - - - - - - - - - - - - - -

- Breakpoint styles -

- - - - - - - -
-
+function ControlsView() { + return ( + + + + + + + + + + ) } + +function ErrorView() { + return ( + + + {}} + /> + + + + + + + + + {}} + /> + + + {}} + numberOfLines={1} + /> + + + ) +} + +function NotifsView() { + const triggerPush = () => { + // TODO: implement local notification for testing + } + const triggerToast = () => { + Toast.show('The task has been completed') + } + const triggerToast2 = () => { + Toast.show('The task has been completed successfully and with no problems') + } + return ( + + + + + + + ) +} + +function BreakpointDebugger() { + const breakpoints = useBreakpoints() + + return ( + +

+ Breakpoint Debugger +

+ + {JSON.stringify(breakpoints, null, 2)} + +
+ ) +} + +function Hooks() { + const outer = useStyle({ + pa: 'm', + bg: 'l1', + }) + const {heading} = useStyles({ + heading: { + color: 'l7', + fontSize: 'l', + fontWeight: 'bold', + gtTablet: { + fontSize: 'xl', + }, + }, + }) + + return ( + + Hooks + + ) +} + +export function DebugScreen() { + const backgroundStyles = useStyle({ + bg: 'l0', + }) + + return ( + + + + + + +

+ Colors +

+ + + + + + + + + + + + + +

+ Spacing +

+ + + + xxs (2px) + + + + xs (4px) + + + + s (8px) + + + + m (12px) + + + + l (18px) + + + + xl (24px) + + + + xxl (32px) + + + + + + + + +

+ Typography +

+ + +

Heading 1

+

Heading 2

+

Heading 3

+

Heading 4

+
Heading 5
+
Heading 6
+ + H1 Size Text + + H2 Size Text + H3 Size Text + H4 Size Text + H5 Size Text + H6 Size Text +
+
+ + +

+ Grid +

+ + + + + + + + + + + + + + + + + + + + + + +

+ Breakpoint styles +

+ + + + + + + +
+
+
+ ) +} diff --git a/src/view/screens/DebugOld.tsx b/src/view/screens/DebugOld.tsx deleted file mode 100644 index 0e0464200e..0000000000 --- a/src/view/screens/DebugOld.tsx +++ /dev/null @@ -1,520 +0,0 @@ -import React from 'react' -import {ScrollView, View} from 'react-native' -import {NativeStackScreenProps, CommonNavigatorParams} from 'lib/routes/types' -import {ViewHeader} from '../com/util/ViewHeader' -import {ThemeProvider, PaletteColorName} from 'lib/ThemeContext' -import {usePalette} from 'lib/hooks/usePalette' -import {s} from 'lib/styles' -import * as Toast from 'view/com/util/Toast' -import {Text} from '../com/util/text/Text' -import {ViewSelector} from '../com/util/ViewSelector' -import {EmptyState} from '../com/util/EmptyState' -import * as LoadingPlaceholder from '../com/util/LoadingPlaceholder' -import {Button, ButtonType} from '../com/util/forms/Button' -import {DropdownButton, DropdownItem} from '../com/util/forms/DropdownButton' -import {ToggleButton} from '../com/util/forms/ToggleButton' -import {RadioGroup} from '../com/util/forms/RadioGroup' -import {ErrorScreen} from '../com/util/error/ErrorScreen' -import {ErrorMessage} from '../com/util/error/ErrorMessage' - -const MAIN_VIEWS = ['Base', 'Controls', 'Error', 'Notifs'] - -export const DebugScreen = ({}: NativeStackScreenProps< - CommonNavigatorParams, - 'Debug' ->) => { - const [colorScheme, setColorScheme] = React.useState<'light' | 'dark'>( - 'light', - ) - const onToggleColorScheme = () => { - setColorScheme(colorScheme === 'light' ? 'dark' : 'light') - } - return ( - - - - ) -} - -function DebugInner({ - colorScheme, - onToggleColorScheme, -}: { - colorScheme: 'light' | 'dark' - onToggleColorScheme: () => void -}) { - const [currentView, setCurrentView] = React.useState(0) - const pal = usePalette('default') - - const renderItem = (item: any) => { - return ( - - - - - {item.currentView === 3 ? ( - - ) : item.currentView === 2 ? ( - - ) : item.currentView === 1 ? ( - - ) : ( - - )} - - ) - } - - const items = [{currentView}] - - return ( - - - - - ) -} - -function Heading({label}: {label: string}) { - const pal = usePalette('default') - return ( - - - {label} - - - ) -} - -function BaseView() { - return ( - - - - - - - - - - - - - - - - ) -} - -function ControlsView() { - return ( - - - - - - - - - - - - ) -} - -function ErrorView() { - return ( - - - {}} - /> - - - - - - - - - {}} - /> - - - {}} - numberOfLines={1} - /> - - - ) -} - -function NotifsView() { - const triggerPush = () => { - // TODO: implement local notification for testing - } - const triggerToast = () => { - Toast.show('The task has been completed') - } - const triggerToast2 = () => { - Toast.show('The task has been completed successfully and with no problems') - } - return ( - - -