mirror of
https://github.com/SrIzan10/featheroom.git
synced 2026-06-06 00:56:49 +00:00
chore: remove locales and lint
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Stack } from 'expo-router'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { StackHeader } from '@/lib/ui'
|
||||
|
||||
const Layout = () => (
|
||||
@@ -10,8 +9,8 @@ const Layout = () => (
|
||||
header: (props) => <StackHeader navProps={props} children={undefined} />,
|
||||
}}
|
||||
>
|
||||
<Stack.Screen name="login" options={{ title: Locales.t('login') }} />
|
||||
<Stack.Screen name="signup" options={{ title: Locales.t('signup') }} />
|
||||
<Stack.Screen name="login" options={{ title: 'Log in' }} />
|
||||
<Stack.Screen name="signup" options={{ title: 'Sign up' }} />
|
||||
</Stack>
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import { Tabs, router } from 'expo-router'
|
||||
import React from 'react'
|
||||
import { Appbar, Menu, Tooltip } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { TabBar, TabsHeader } from '@/lib/ui'
|
||||
|
||||
const TabLayout = () => {
|
||||
@@ -20,10 +19,10 @@ const TabLayout = () => {
|
||||
<Tabs.Screen
|
||||
name="index"
|
||||
options={{
|
||||
title: Locales.t('titleHome'),
|
||||
title: 'Home',
|
||||
headerRight: () => (
|
||||
<>
|
||||
<Tooltip title={Locales.t('search')}>
|
||||
<Tooltip title="Search">
|
||||
<Appbar.Action
|
||||
icon="magnify"
|
||||
onPress={() => router.push('/search')}
|
||||
@@ -34,7 +33,7 @@ const TabLayout = () => {
|
||||
visible={visible}
|
||||
onDismiss={() => setVisible(false)}
|
||||
anchor={
|
||||
<Tooltip title={Locales.t('options')}>
|
||||
<Tooltip title="Options">
|
||||
<Appbar.Action
|
||||
icon="dots-vertical"
|
||||
onPress={() => setVisible(true)}
|
||||
@@ -43,17 +42,17 @@ const TabLayout = () => {
|
||||
}
|
||||
>
|
||||
<Menu.Item
|
||||
title={Locales.t('titleSettings')}
|
||||
title="Settings"
|
||||
leadingIcon="cog"
|
||||
onPress={() => router.push('/(tabs)/settings')}
|
||||
/>
|
||||
<Menu.Item
|
||||
title={Locales.t('stackNav')}
|
||||
title="Stack Navigation"
|
||||
leadingIcon="card-multiple-outline"
|
||||
onPress={() => router.push('/modal')}
|
||||
/>
|
||||
<Menu.Item
|
||||
title={Locales.t('drawerNav')}
|
||||
title="Drawer Navigation"
|
||||
leadingIcon="gesture-swipe"
|
||||
onPress={() => router.push('/drawer')}
|
||||
/>
|
||||
@@ -72,16 +71,16 @@ const TabLayout = () => {
|
||||
<Tabs.Screen
|
||||
name="profile"
|
||||
options={{
|
||||
title: Locales.t('profile'),
|
||||
title: 'Profile',
|
||||
headerRight: () => (
|
||||
<>
|
||||
<Tooltip title={Locales.t('search')}>
|
||||
<Tooltip title="Search">
|
||||
<Appbar.Action
|
||||
icon="magnify"
|
||||
onPress={() => router.push('/search')}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip title={Locales.t('titleSettings')}>
|
||||
<Tooltip title="Settings">
|
||||
<Appbar.Action
|
||||
icon="cog"
|
||||
onPress={() => router.push('/(tabs)/settings')}
|
||||
@@ -101,9 +100,9 @@ const TabLayout = () => {
|
||||
<Tabs.Screen
|
||||
name="settings"
|
||||
options={{
|
||||
title: Locales.t('titleSettings'),
|
||||
title: 'Settings',
|
||||
headerRight: () => (
|
||||
<Tooltip title={Locales.t('drawerNav')}>
|
||||
<Tooltip title="Drawer Navigation">
|
||||
<Appbar.Action
|
||||
icon="gesture-swipe"
|
||||
onPress={() => router.push('/drawer')}
|
||||
@@ -122,5 +121,4 @@ const TabLayout = () => {
|
||||
</Tabs>
|
||||
)
|
||||
}
|
||||
|
||||
export default TabLayout
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import React from 'react'
|
||||
import { Surface } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { ScreenInfo, styles } from '@/lib/ui'
|
||||
|
||||
const TabsHome = () => (
|
||||
<Surface style={styles.screen}>
|
||||
<ScreenInfo title={Locales.t('titleHome')} path="app/(tabs)/index.tsx" />
|
||||
<ScreenInfo title="Home" path="app/(tabs)/index.tsx" />
|
||||
</Surface>
|
||||
)
|
||||
|
||||
|
||||
@@ -2,12 +2,11 @@ import { router } from 'expo-router'
|
||||
import React from 'react'
|
||||
import { Button, Surface } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { ScreenInfo, styles } from '@/lib/ui'
|
||||
|
||||
const Profile = () => (
|
||||
<Surface style={styles.screen}>
|
||||
<ScreenInfo title={Locales.t('profile')} path="app/(tabs)/profile.tsx" />
|
||||
<ScreenInfo title="Profile" path="app/(tabs)/profile.tsx" />
|
||||
|
||||
<Surface
|
||||
elevation={0}
|
||||
|
||||
@@ -11,10 +11,8 @@ import {
|
||||
Icon,
|
||||
} from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { Color, Language, Setting } from '@/lib/types'
|
||||
import { Color, Setting } from '@/lib/types'
|
||||
import { Colors, LoadingIndicator, ScreenInfo, styles } from '@/lib/ui'
|
||||
import { Languages } from '@/lib/utils'
|
||||
|
||||
const Settings = () => {
|
||||
const colorScheme = useColorScheme()
|
||||
@@ -22,12 +20,10 @@ const Settings = () => {
|
||||
const [message, setMessage] = React.useState({ visible: false, content: '' })
|
||||
const [settings, setSettings] = React.useState<Setting>({
|
||||
color: 'default',
|
||||
language: 'auto',
|
||||
theme: 'auto',
|
||||
})
|
||||
const [display, setDisplay] = React.useState({
|
||||
color: false,
|
||||
language: false,
|
||||
theme: false,
|
||||
})
|
||||
|
||||
@@ -65,61 +61,12 @@ const Settings = () => {
|
||||
<List.AccordionGroup>
|
||||
<List.Accordion
|
||||
id="1"
|
||||
title={Locales.t('appearance')}
|
||||
title="Appearance"
|
||||
left={(props) => <List.Icon {...props} icon="palette" />}
|
||||
>
|
||||
<List.Item
|
||||
title={Locales.t('language')}
|
||||
description={Locales.t('changeLanguage')}
|
||||
left={(props) => <List.Icon {...props} icon="translate" />}
|
||||
right={(props) => (
|
||||
<Menu
|
||||
visible={display.language}
|
||||
onDismiss={() =>
|
||||
setDisplay({ ...display, language: false })
|
||||
}
|
||||
anchor={
|
||||
<IconButton
|
||||
{...props}
|
||||
icon="pencil"
|
||||
onPress={() =>
|
||||
setDisplay({ ...display, language: true })
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Menu.Item
|
||||
title="System"
|
||||
trailingIcon={
|
||||
settings.language === 'auto' ? 'check' : undefined
|
||||
}
|
||||
onPress={() => {
|
||||
setSettings({ ...settings, language: 'auto' })
|
||||
setDisplay({ ...display, language: false })
|
||||
}}
|
||||
/>
|
||||
{Object.entries(Languages).map((lang) => (
|
||||
<Menu.Item
|
||||
key={lang[0]}
|
||||
title={`${lang[1].name} / ${lang[1].nativeName}`}
|
||||
trailingIcon={
|
||||
settings.language === lang[0] ? 'check' : undefined
|
||||
}
|
||||
onPress={() => {
|
||||
setSettings({
|
||||
...settings,
|
||||
language: lang[0] as Language,
|
||||
})
|
||||
setDisplay({ ...display, language: false })
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</Menu>
|
||||
)}
|
||||
/>
|
||||
<List.Item
|
||||
title={Locales.t('mode')}
|
||||
description={Locales.t('changeMode')}
|
||||
title="Mode"
|
||||
description="Change Mode"
|
||||
left={(props) => (
|
||||
<List.Icon
|
||||
{...props}
|
||||
@@ -145,7 +92,7 @@ const Settings = () => {
|
||||
}
|
||||
>
|
||||
<Menu.Item
|
||||
title={Locales.t('system')}
|
||||
title="System"
|
||||
leadingIcon="theme-light-dark"
|
||||
trailingIcon={
|
||||
settings.theme === 'auto' ? 'check' : undefined
|
||||
@@ -156,7 +103,7 @@ const Settings = () => {
|
||||
}}
|
||||
/>
|
||||
<Menu.Item
|
||||
title={Locales.t('lightMode')}
|
||||
title="Light Mode"
|
||||
leadingIcon="weather-sunny"
|
||||
trailingIcon={
|
||||
settings.theme === 'light' ? 'check' : undefined
|
||||
@@ -167,7 +114,7 @@ const Settings = () => {
|
||||
}}
|
||||
/>
|
||||
<Menu.Item
|
||||
title={Locales.t('darkMode')}
|
||||
title="Dark Mode"
|
||||
leadingIcon="weather-night"
|
||||
trailingIcon={
|
||||
settings.theme === 'dark' ? 'check' : undefined
|
||||
@@ -181,8 +128,8 @@ const Settings = () => {
|
||||
)}
|
||||
/>
|
||||
<List.Item
|
||||
title={Locales.t('color')}
|
||||
description={Locales.t('changeColor')}
|
||||
title="Color"
|
||||
description="Change Color"
|
||||
left={(props) => (
|
||||
<List.Icon
|
||||
{...props}
|
||||
@@ -243,7 +190,7 @@ const Settings = () => {
|
||||
|
||||
<Menu.Item
|
||||
key={color}
|
||||
title={Locales.t(color)}
|
||||
title={color}
|
||||
onPress={() => {
|
||||
setSettings({
|
||||
...settings,
|
||||
@@ -263,10 +210,7 @@ const Settings = () => {
|
||||
)}
|
||||
|
||||
<Surface elevation={0} style={styles.screen}>
|
||||
<ScreenInfo
|
||||
title={Locales.t('titleSettings')}
|
||||
path="app/(tabs)/settings.tsx"
|
||||
/>
|
||||
<ScreenInfo title="Settings" path="app/(tabs)/settings.tsx" />
|
||||
</Surface>
|
||||
|
||||
<Button
|
||||
@@ -278,7 +222,7 @@ const Settings = () => {
|
||||
.then(() =>
|
||||
setMessage({
|
||||
visible: true,
|
||||
content: Locales.t('restartApp'),
|
||||
content: 'Please restart the app to apply changes.',
|
||||
}),
|
||||
)
|
||||
.catch((res) =>
|
||||
@@ -289,11 +233,11 @@ const Settings = () => {
|
||||
)
|
||||
: setMessage({
|
||||
visible: true,
|
||||
content: Locales.t('notAvailable'),
|
||||
content: 'This feature is not available on the web.',
|
||||
})
|
||||
}
|
||||
>
|
||||
{Locales.t('save')}
|
||||
Save
|
||||
</Button>
|
||||
|
||||
<Snackbar
|
||||
|
||||
@@ -2,19 +2,20 @@ import { Link, Stack } from 'expo-router'
|
||||
import React from 'react'
|
||||
import { Surface, Text } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { styles } from '@/lib/ui'
|
||||
|
||||
const NotFound = () => (
|
||||
<Surface style={styles.screen}>
|
||||
<Stack.Screen options={{ title: Locales.t('titleNotFound') }} />
|
||||
<Stack.Screen options={{ title: 'Not Found' }} />
|
||||
|
||||
<Text variant="displayLarge">{Locales.t('titleNotFound')}</Text>
|
||||
<Text variant="displayLarge">Not Found</Text>
|
||||
|
||||
<Text variant="bodyLarge">{Locales.t('screen404')}</Text>
|
||||
<Text variant="bodyLarge">
|
||||
The screen you are looking for does not exist.
|
||||
</Text>
|
||||
|
||||
<Link href="/">
|
||||
<Text variant="bodyLarge">{Locales.t('goHome')}</Text>
|
||||
<Text variant="bodyLarge">Go Home</Text>
|
||||
</Link>
|
||||
</Surface>
|
||||
)
|
||||
|
||||
@@ -4,14 +4,12 @@ import {
|
||||
JetBrainsMono_400Regular,
|
||||
} from '@expo-google-fonts/jetbrains-mono'
|
||||
import { NotoSans_400Regular } from '@expo-google-fonts/noto-sans'
|
||||
import * as Localization from 'expo-localization'
|
||||
import { SplashScreen, Stack } from 'expo-router'
|
||||
import * as SecureStore from 'expo-secure-store'
|
||||
import React from 'react'
|
||||
import { Platform, useColorScheme } from 'react-native'
|
||||
import { PaperProvider } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { Setting } from '@/lib/types'
|
||||
import { StackHeader, Themes } from '@/lib/ui'
|
||||
|
||||
@@ -58,7 +56,6 @@ const RootLayoutNav = () => {
|
||||
const [settings, setSettings] = React.useState<Setting>({
|
||||
theme: 'auto',
|
||||
color: 'default',
|
||||
language: 'auto',
|
||||
})
|
||||
|
||||
// Load settings from the device
|
||||
@@ -80,16 +77,6 @@ const RootLayoutNav = () => {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
React.useEffect(() => {
|
||||
if (settings.language === 'auto') {
|
||||
Locales.locale = Localization.getLocales()[0].languageCode ?? 'en'
|
||||
} else {
|
||||
Locales.locale = settings.language
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<PaperProvider
|
||||
theme={
|
||||
@@ -109,10 +96,10 @@ const RootLayoutNav = () => {
|
||||
<Stack.Screen name="(auth)" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="drawer" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="search" options={{ title: Locales.t('search') }} />
|
||||
<Stack.Screen name="search" options={{ title: 'Search' }} />
|
||||
<Stack.Screen
|
||||
name="modal"
|
||||
options={{ title: Locales.t('titleModal'), presentation: 'modal' }}
|
||||
options={{ title: 'Modal', presentation: 'modal' }}
|
||||
/>
|
||||
</Stack>
|
||||
</PaperProvider>
|
||||
|
||||
@@ -4,7 +4,6 @@ import React from 'react'
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler'
|
||||
import { Appbar, Menu, Tooltip, useTheme } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { DrawerContent, DrawerHeader } from '@/lib/ui'
|
||||
|
||||
const DrawerLayout = () => {
|
||||
@@ -35,11 +34,11 @@ const DrawerLayout = () => {
|
||||
<Drawer.Screen
|
||||
name="index"
|
||||
options={{
|
||||
drawerLabel: Locales.t('titleHome'),
|
||||
title: Locales.t('titleHome'),
|
||||
drawerLabel: 'Home',
|
||||
title: 'Home',
|
||||
headerRight: () => (
|
||||
<>
|
||||
<Tooltip title={Locales.t('search')}>
|
||||
<Tooltip title="Search">
|
||||
<Appbar.Action
|
||||
icon="magnify"
|
||||
onPress={() => router.push('/search')}
|
||||
@@ -50,7 +49,7 @@ const DrawerLayout = () => {
|
||||
visible={visible}
|
||||
onDismiss={() => setVisible(false)}
|
||||
anchor={
|
||||
<Tooltip title={Locales.t('options')}>
|
||||
<Tooltip title="Options">
|
||||
<Appbar.Action
|
||||
icon="dots-vertical"
|
||||
onPress={() => setVisible(true)}
|
||||
@@ -59,17 +58,17 @@ const DrawerLayout = () => {
|
||||
}
|
||||
>
|
||||
<Menu.Item
|
||||
title={Locales.t('titleSettings')}
|
||||
title="Settings"
|
||||
leadingIcon="cog"
|
||||
onPress={() => router.push('/drawer/settings')}
|
||||
/>
|
||||
<Menu.Item
|
||||
title={Locales.t('stackNav')}
|
||||
title="Stack Navigation"
|
||||
leadingIcon="card-multiple-outline"
|
||||
onPress={() => router.push('/modal')}
|
||||
/>
|
||||
<Menu.Item
|
||||
title={Locales.t('drawerNav')}
|
||||
title="Drawer Navigation"
|
||||
leadingIcon="gesture-swipe"
|
||||
onPress={() => router.push('/drawer')}
|
||||
/>
|
||||
@@ -81,17 +80,17 @@ const DrawerLayout = () => {
|
||||
<Drawer.Screen
|
||||
name="profile"
|
||||
options={{
|
||||
drawerLabel: Locales.t('profile'),
|
||||
title: Locales.t('profile'),
|
||||
drawerLabel: 'Profile',
|
||||
title: 'Profile',
|
||||
headerRight: () => (
|
||||
<>
|
||||
<Tooltip title={Locales.t('search')}>
|
||||
<Tooltip title="Search">
|
||||
<Appbar.Action
|
||||
icon="magnify"
|
||||
onPress={() => router.push('/search')}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip title={Locales.t('titleSettings')}>
|
||||
<Tooltip title="Settings">
|
||||
<Appbar.Action
|
||||
icon="cog"
|
||||
onPress={() => router.push('/(tabs)/settings')}
|
||||
@@ -104,10 +103,10 @@ const DrawerLayout = () => {
|
||||
<Drawer.Screen
|
||||
name="settings"
|
||||
options={{
|
||||
drawerLabel: Locales.t('titleSettings'),
|
||||
title: Locales.t('titleSettings'),
|
||||
drawerLabel: 'Settings',
|
||||
title: 'Settings',
|
||||
headerRight: () => (
|
||||
<Tooltip title={Locales.t('stackNav')}>
|
||||
<Tooltip title="Stack Navigation">
|
||||
<Appbar.Action
|
||||
icon="card-multiple-outline"
|
||||
onPress={() => router.push('/modal')}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import React from 'react'
|
||||
import { Surface } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { ScreenInfo, styles } from '@/lib/ui'
|
||||
|
||||
const DrawerHome = () => (
|
||||
<Surface style={styles.screen}>
|
||||
<ScreenInfo title={Locales.t('titleHome')} path="app/drawer/index.tsx" />
|
||||
<ScreenInfo title="Home" path="app/drawer/index.tsx" />
|
||||
</Surface>
|
||||
)
|
||||
|
||||
|
||||
@@ -2,12 +2,11 @@ import { router } from 'expo-router'
|
||||
import React from 'react'
|
||||
import { Button, Surface } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { ScreenInfo, styles } from '@/lib/ui'
|
||||
|
||||
const Profile = () => (
|
||||
<Surface style={styles.screen}>
|
||||
<ScreenInfo title={Locales.t('profile')} path="app/(tabs)/profile.tsx" />
|
||||
<ScreenInfo title="Profile" path="app/(tabs)/profile.tsx" />
|
||||
|
||||
<Surface
|
||||
elevation={0}
|
||||
|
||||
@@ -11,10 +11,8 @@ import {
|
||||
Icon,
|
||||
} from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { Color, Language, Setting } from '@/lib/types'
|
||||
import { Color, Setting } from '@/lib/types'
|
||||
import { Colors, LoadingIndicator, ScreenInfo, styles } from '@/lib/ui'
|
||||
import { Languages } from '@/lib/utils'
|
||||
|
||||
const Settings = () => {
|
||||
const colorScheme = useColorScheme()
|
||||
@@ -22,12 +20,10 @@ const Settings = () => {
|
||||
const [message, setMessage] = React.useState({ visible: false, content: '' })
|
||||
const [settings, setSettings] = React.useState<Setting>({
|
||||
color: 'default',
|
||||
language: 'auto',
|
||||
theme: 'auto',
|
||||
})
|
||||
const [display, setDisplay] = React.useState({
|
||||
color: false,
|
||||
language: false,
|
||||
theme: false,
|
||||
})
|
||||
|
||||
@@ -65,61 +61,12 @@ const Settings = () => {
|
||||
<List.AccordionGroup>
|
||||
<List.Accordion
|
||||
id="1"
|
||||
title={Locales.t('appearance')}
|
||||
title="Appearance"
|
||||
left={(props) => <List.Icon {...props} icon="palette" />}
|
||||
>
|
||||
<List.Item
|
||||
title={Locales.t('language')}
|
||||
description={Locales.t('changeLanguage')}
|
||||
left={(props) => <List.Icon {...props} icon="translate" />}
|
||||
right={(props) => (
|
||||
<Menu
|
||||
visible={display.language}
|
||||
onDismiss={() =>
|
||||
setDisplay({ ...display, language: false })
|
||||
}
|
||||
anchor={
|
||||
<IconButton
|
||||
{...props}
|
||||
icon="pencil"
|
||||
onPress={() =>
|
||||
setDisplay({ ...display, language: true })
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Menu.Item
|
||||
title="System"
|
||||
trailingIcon={
|
||||
settings.language === 'auto' ? 'check' : undefined
|
||||
}
|
||||
onPress={() => {
|
||||
setSettings({ ...settings, language: 'auto' })
|
||||
setDisplay({ ...display, language: false })
|
||||
}}
|
||||
/>
|
||||
{Object.entries(Languages).map((lang) => (
|
||||
<Menu.Item
|
||||
key={lang[0]}
|
||||
title={`${lang[1].name} / ${lang[1].nativeName}`}
|
||||
trailingIcon={
|
||||
settings.language === lang[0] ? 'check' : undefined
|
||||
}
|
||||
onPress={() => {
|
||||
setSettings({
|
||||
...settings,
|
||||
language: lang[0] as Language,
|
||||
})
|
||||
setDisplay({ ...display, language: false })
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</Menu>
|
||||
)}
|
||||
/>
|
||||
<List.Item
|
||||
title={Locales.t('mode')}
|
||||
description={Locales.t('changeMode')}
|
||||
title="Mode"
|
||||
description="Change Mode"
|
||||
left={(props) => (
|
||||
<List.Icon
|
||||
{...props}
|
||||
@@ -145,7 +92,7 @@ const Settings = () => {
|
||||
}
|
||||
>
|
||||
<Menu.Item
|
||||
title={Locales.t('system')}
|
||||
title="System"
|
||||
leadingIcon="theme-light-dark"
|
||||
trailingIcon={
|
||||
settings.theme === 'auto' ? 'check' : undefined
|
||||
@@ -156,7 +103,7 @@ const Settings = () => {
|
||||
}}
|
||||
/>
|
||||
<Menu.Item
|
||||
title={Locales.t('lightMode')}
|
||||
title="Light Mode"
|
||||
leadingIcon="weather-sunny"
|
||||
trailingIcon={
|
||||
settings.theme === 'light' ? 'check' : undefined
|
||||
@@ -167,7 +114,7 @@ const Settings = () => {
|
||||
}}
|
||||
/>
|
||||
<Menu.Item
|
||||
title={Locales.t('darkMode')}
|
||||
title="Dark Mode"
|
||||
leadingIcon="weather-night"
|
||||
trailingIcon={
|
||||
settings.theme === 'dark' ? 'check' : undefined
|
||||
@@ -181,8 +128,8 @@ const Settings = () => {
|
||||
)}
|
||||
/>
|
||||
<List.Item
|
||||
title={Locales.t('color')}
|
||||
description={Locales.t('changeColor')}
|
||||
title="Color"
|
||||
description="Change Color"
|
||||
left={(props) => (
|
||||
<List.Icon
|
||||
{...props}
|
||||
@@ -243,7 +190,7 @@ const Settings = () => {
|
||||
|
||||
<Menu.Item
|
||||
key={color}
|
||||
title={Locales.t(color)}
|
||||
title={color}
|
||||
onPress={() => {
|
||||
setSettings({
|
||||
...settings,
|
||||
@@ -263,10 +210,7 @@ const Settings = () => {
|
||||
)}
|
||||
|
||||
<Surface elevation={0} style={styles.screen}>
|
||||
<ScreenInfo
|
||||
title={Locales.t('titleSettings')}
|
||||
path="app/(tabs)/settings.tsx"
|
||||
/>
|
||||
<ScreenInfo title="Settings" path="app/(tabs)/settings.tsx" />
|
||||
</Surface>
|
||||
|
||||
<Button
|
||||
@@ -278,7 +222,7 @@ const Settings = () => {
|
||||
.then(() =>
|
||||
setMessage({
|
||||
visible: true,
|
||||
content: Locales.t('restartApp'),
|
||||
content: 'Please restart the app to apply changes.',
|
||||
}),
|
||||
)
|
||||
.catch((res) =>
|
||||
@@ -289,11 +233,11 @@ const Settings = () => {
|
||||
)
|
||||
: setMessage({
|
||||
visible: true,
|
||||
content: Locales.t('notAvailable'),
|
||||
content: 'This feature is not available on the web.',
|
||||
})
|
||||
}
|
||||
>
|
||||
{Locales.t('save')}
|
||||
Save
|
||||
</Button>
|
||||
|
||||
<Snackbar
|
||||
|
||||
@@ -3,12 +3,11 @@ import React from 'react'
|
||||
import { Platform } from 'react-native'
|
||||
import { Surface } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { ScreenInfo, styles } from '@/lib/ui'
|
||||
|
||||
const Modal = () => (
|
||||
<Surface style={styles.screen}>
|
||||
<ScreenInfo title={Locales.t('titleModal')} path="app/modal.tsx" />
|
||||
<ScreenInfo title="Modal" path="app/modal.tsx" />
|
||||
|
||||
{/* Use a light status bar on iOS to account for the black space above the modal */}
|
||||
<StatusBar style={Platform.OS === 'ios' ? 'light' : 'auto'} />
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Searchbar, Surface } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import { ScreenInfo, styles } from '@/lib/ui'
|
||||
|
||||
const Search = () => {
|
||||
@@ -30,7 +29,7 @@ const Search = () => {
|
||||
/>
|
||||
|
||||
<Surface style={styles.screen}>
|
||||
<ScreenInfo title={Locales.t('search')} path="app/search.tsx" />
|
||||
<ScreenInfo title="Search" path="app/search.tsx" />
|
||||
</Surface>
|
||||
</Surface>
|
||||
)
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* Arabic Translations
|
||||
*/
|
||||
|
||||
const Arabic = {
|
||||
login: 'تسجيل الدخول',
|
||||
signup: 'إنشاء حساب',
|
||||
profile: 'الملف الشخصي',
|
||||
options: 'الخيارات',
|
||||
search: 'البحث',
|
||||
stackNav: 'التنقل المكدس',
|
||||
drawerNav: 'التنقل الدرج',
|
||||
appearance: 'المظهر',
|
||||
language: 'اللغة',
|
||||
changeLanguage: 'تغيير لغة التطبيق',
|
||||
system: 'النظام',
|
||||
mode: 'الوضع',
|
||||
changeMode: 'التبديل بين الوضع الفاتح والوضع الداكن',
|
||||
lightMode: 'فاتح',
|
||||
darkMode: 'داكن',
|
||||
color: 'اللون',
|
||||
changeColor: 'تغيير لون السمة',
|
||||
changeScreenCode:
|
||||
'قم بتغيير أي نص، احفظ الملف، وسيتم تحديث التطبيق الخاص بك تلقائيًا',
|
||||
goHome: 'الذهاب إلى الشاشة الرئيسية',
|
||||
openScreenCode: 'افتح الكود لهذه الشاشة',
|
||||
save: 'حفظ',
|
||||
screen404: 'هذه الشاشة غير موجودة',
|
||||
titleHome: 'الرئيسية',
|
||||
titleModal: 'مشروط',
|
||||
titleNotFound: 'لم يتم العثور',
|
||||
titleSettings: 'الإعدادات',
|
||||
restartApp: 'أعد تشغيل التطبيق لتطبيق التغييرات',
|
||||
notAvailable: 'Expo SecureStore غير متوفر للويب',
|
||||
adaptive: 'تلقائي',
|
||||
default: 'افتراضي',
|
||||
orange: 'برتقالي',
|
||||
red: 'أحمر',
|
||||
violet: 'بنفسجي',
|
||||
indigo: 'أزرق داكن',
|
||||
blue: 'أزرق',
|
||||
teal: 'أزرق فاتح',
|
||||
cyan: 'سماوي',
|
||||
green: 'أخضر',
|
||||
lime: 'ليموني',
|
||||
olive: 'زيتوني',
|
||||
brown: 'بني',
|
||||
}
|
||||
|
||||
export default Arabic
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* English Translations
|
||||
*/
|
||||
|
||||
const English = {
|
||||
login: 'Log in',
|
||||
signup: 'Sign up',
|
||||
profile: 'Profile',
|
||||
options: 'Options',
|
||||
search: 'Search',
|
||||
stackNav: 'Stack Navigation',
|
||||
drawerNav: 'Drawer Navigation',
|
||||
appearance: 'Appearance',
|
||||
language: 'Language',
|
||||
changeLanguage: "Change app's language",
|
||||
system: 'System',
|
||||
mode: 'Mode',
|
||||
changeMode: 'Switch between light and dark mode',
|
||||
lightMode: 'Light',
|
||||
darkMode: 'Dark',
|
||||
color: 'Color',
|
||||
changeColor: 'Change theme color',
|
||||
changeScreenCode:
|
||||
'Change any of the text, save the file, and your app will automatically update',
|
||||
goHome: 'Go to home screen',
|
||||
openScreenCode: 'Open up the code for this screen',
|
||||
save: 'Save',
|
||||
screen404: "This screen doesn't exist",
|
||||
titleHome: 'Home',
|
||||
titleModal: 'Modal',
|
||||
titleNotFound: 'Not Found',
|
||||
titleSettings: 'Settings',
|
||||
restartApp: 'Restart the app to apply changes',
|
||||
notAvailable: 'Expo SecureStore is not available for web',
|
||||
adaptive: 'adaptive',
|
||||
default: 'default',
|
||||
orange: 'orange',
|
||||
red: 'red',
|
||||
violet: 'violet',
|
||||
indigo: 'indigo',
|
||||
blue: 'blue',
|
||||
teal: 'teal',
|
||||
cyan: 'cyan',
|
||||
green: 'green',
|
||||
lime: 'lime',
|
||||
olive: 'olive',
|
||||
brown: 'brown',
|
||||
}
|
||||
|
||||
export default English
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* Locales
|
||||
*/
|
||||
|
||||
import { I18n } from 'i18n-js'
|
||||
|
||||
import Arabic from '@/lib/locales/ar'
|
||||
import English from '@/lib/locales/en'
|
||||
import Turkish from '@/lib/locales/tr'
|
||||
|
||||
const Locales = new I18n({
|
||||
ar: Arabic,
|
||||
en: English,
|
||||
tr: Turkish,
|
||||
})
|
||||
|
||||
Locales.enableFallback = true
|
||||
|
||||
export default Locales
|
||||
@@ -1,48 +0,0 @@
|
||||
/**
|
||||
* Turkish Translations
|
||||
*/
|
||||
|
||||
const Turkish = {
|
||||
login: 'Giriş',
|
||||
signup: 'Hesap aç',
|
||||
profile: 'Profil',
|
||||
search: 'Ara',
|
||||
drawerNav: 'Çekmece Navigasyon',
|
||||
appearance: 'Görünüm',
|
||||
language: 'Dil',
|
||||
changeLanguage: 'Uygulamanın dilini değiştir',
|
||||
system: 'Sistem',
|
||||
mode: 'Mod',
|
||||
changeMode: 'Aydınlık ve karanlık mod arasında geçiş yap',
|
||||
lightMode: 'Aydınlık',
|
||||
darkMode: 'Karanlık',
|
||||
color: 'Renk',
|
||||
changeColor: 'Tema rengini değiştir',
|
||||
changeScreenCode:
|
||||
'Herhangi bir metni değiştirin, dosyayı kaydedin ve uygulamanız otomatik olarak güncellenecektir',
|
||||
goHome: 'Ana ekrana git',
|
||||
openScreenCode: 'Bu ekranın kodunu aç',
|
||||
save: 'Kaydet',
|
||||
screen404: 'Bu ekran mevcut değil',
|
||||
titleHome: 'Ana Sayfa',
|
||||
titleModal: 'Modal',
|
||||
titleNotFound: 'Bulunamadı',
|
||||
titleSettings: 'Ayarlar',
|
||||
restartApp: 'Değişiklikleri uygulamak için uygulamayı yeniden başlatın',
|
||||
notAvailable: 'Expo SecureStore web için kullanılabilir değil',
|
||||
adaptive: 'adaptive',
|
||||
default: 'varsayılan',
|
||||
orange: 'turuncu',
|
||||
red: 'kırmızı',
|
||||
violet: 'mor',
|
||||
indigo: 'lacivert',
|
||||
blue: 'mavi',
|
||||
teal: 'turkuaz',
|
||||
cyan: 'gökyüzü mavi',
|
||||
green: 'yeşil',
|
||||
lime: 'limon yeşili',
|
||||
olive: 'zeytin yeşili',
|
||||
brown: 'kahverengi',
|
||||
}
|
||||
|
||||
export default Turkish
|
||||
@@ -1,5 +0,0 @@
|
||||
import { Languages } from '@/lib/utils'
|
||||
|
||||
type Language = keyof typeof Languages
|
||||
|
||||
export default Language
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Color, Language } from '@/lib/types'
|
||||
import { Color } from '@/lib/types'
|
||||
|
||||
type Setting = {
|
||||
color: Color
|
||||
theme: 'light' | 'dark' | 'auto'
|
||||
language: Language | 'auto'
|
||||
}
|
||||
|
||||
export default Setting
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
import Color from '@/lib/types/Color'
|
||||
import Language from '@/lib/types/Language'
|
||||
import Setting from '@/lib/types/Setting'
|
||||
|
||||
export type { Color, Language, Setting }
|
||||
export type { Color, Setting }
|
||||
|
||||
@@ -3,8 +3,6 @@ import { router } from 'expo-router'
|
||||
import React from 'react'
|
||||
import { Drawer, DrawerSectionProps } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
|
||||
interface DrawerContentProps extends DrawerSectionProps {
|
||||
navProps: DrawerContentComponentProps
|
||||
}
|
||||
@@ -12,24 +10,24 @@ interface DrawerContentProps extends DrawerSectionProps {
|
||||
const DrawerContent = (props: DrawerContentProps) => (
|
||||
<Drawer.Section {...props}>
|
||||
<Drawer.Item
|
||||
label={Locales.t('goHome')}
|
||||
label="Go Home"
|
||||
icon="arrow-left"
|
||||
onPress={() => router.replace('/')}
|
||||
/>
|
||||
<Drawer.Item
|
||||
label={Locales.t('titleHome')}
|
||||
label="Home"
|
||||
icon="home"
|
||||
active={props.navProps.state.index === 0}
|
||||
onPress={() => router.push('/drawer')}
|
||||
/>
|
||||
<Drawer.Item
|
||||
label={Locales.t('profile')}
|
||||
label="Profile"
|
||||
icon="account"
|
||||
active={props.navProps.state.index === 1}
|
||||
onPress={() => router.push('/drawer/profile')}
|
||||
/>
|
||||
<Drawer.Item
|
||||
label={Locales.t('titleSettings')}
|
||||
label="Settings"
|
||||
icon="cog"
|
||||
active={props.navProps.state.index === 2}
|
||||
onPress={() => router.push('/drawer/settings')}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Chip, Text } from 'react-native-paper'
|
||||
|
||||
import Locales from '@/lib/locales'
|
||||
import GradientBackground from '@/lib/ui/components/GradientBackground'
|
||||
|
||||
const ScreenInfo = (props: { title: string; path: string }) => (
|
||||
@@ -9,14 +8,14 @@ const ScreenInfo = (props: { title: string; path: string }) => (
|
||||
|
||||
<Text variant="displaySmall">{props.title}</Text>
|
||||
|
||||
<Text variant="bodyLarge">{Locales.t('openScreenCode')}</Text>
|
||||
<Text variant="bodyLarge">Open the screen code to edit it.</Text>
|
||||
|
||||
<Chip textStyle={{ fontFamily: 'JetBrainsMono_400Regular' }}>
|
||||
{props.path}
|
||||
</Chip>
|
||||
|
||||
<Text variant="bodyLarge" style={{ textAlign: 'center' }}>
|
||||
{Locales.t('changeScreenCode')}
|
||||
Change the screen code to see updates.
|
||||
</Text>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* Utilities
|
||||
*/
|
||||
|
||||
import Languages from '@/lib/utils/languages'
|
||||
|
||||
export { Languages }
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Available languages
|
||||
*/
|
||||
|
||||
const Languages = {
|
||||
ar: {
|
||||
name: 'Arabic',
|
||||
nativeName: 'العربية',
|
||||
},
|
||||
en: {
|
||||
name: 'English',
|
||||
nativeName: 'English',
|
||||
},
|
||||
tr: {
|
||||
name: 'Turkish',
|
||||
nativeName: 'Türkçe',
|
||||
},
|
||||
}
|
||||
|
||||
export default Languages
|
||||
@@ -26,6 +26,7 @@
|
||||
"@shopify/react-native-skia": "1.2.3",
|
||||
"expo": "~51.0.31",
|
||||
"expo-font": "~12.0.5",
|
||||
"expo-image": "~1.13.0",
|
||||
"expo-linking": "~6.3.1",
|
||||
"expo-localization": "~15.0.3",
|
||||
"expo-router": "~3.5.23",
|
||||
@@ -45,8 +46,7 @@
|
||||
"react-native-safe-area-context": "4.10.5",
|
||||
"react-native-screens": "3.31.1",
|
||||
"react-native-web": "~0.19.6",
|
||||
"yup": "^1.4.0",
|
||||
"expo-image": "~1.12.15"
|
||||
"yup": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
|
||||
Reference in New Issue
Block a user