Skip to content

Commit

Permalink
Misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUltDev committed Jul 8, 2024
1 parent 0119df9 commit dd3b9e8
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 112 deletions.
107 changes: 57 additions & 50 deletions client/src/app/base/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Trans} from '@lingui/macro';
import {Icon} from 'react-exo/icon';
import {useStyles, createStyleSheet} from 'react-native-unistyles';
import {View, Text, StyleSheet} from 'react-native';
import {View, ScrollView, Text, StyleSheet} from 'react-native';
import {useLists} from 'tasks/hooks/useLists';
import {MenuItem} from './MenuItem';
import config from 'config';
Expand All @@ -15,71 +15,78 @@ export function Menu(props: MenuProps) {
const taskLists = useLists();
const hasDevMenu = __DEV__ || config.LIB_NAME === 'react-exo';
return (
<View style={[
styles.root,
props.tabs && styles.rootTabs,
]}>
<MenuItem
path="/"
label={<Trans>Dashboard</Trans>}
icon={<Icon name="ph:squares-four"/>}
tab={props.tabs}
/>
<MenuItem
path="/calendar"
label={<Trans>Calendar</Trans>}
icon={<Icon name="ph:calendar-dots"/>}
tab={props.tabs}
/>
<MenuItem
path="/tasks"
label={<Trans>Tasks</Trans>}
icon={<Icon name="ph:list-checks"/>}
tab={props.tabs}
/>
{props.tabs ? null : taskLists.map(({id, complete}) =>
<MenuItem
sub
key={id}
path={`/tasks/${id}`}
label={<Text>{id}</Text>}
striked={complete}
/>
)}
<View style={styles.fill}/>
{hasDevMenu &&
<>
<View style={styles.bg}>
<ScrollView horizontal={props.tabs} contentContainerStyle={{flexGrow: 1}}>
<View style={[
styles.root,
props.tabs && styles.rootTabs,
]}>
<MenuItem
path="/design"
label={<Trans>Design</Trans>}
icon={<Icon name="ph:palette"/>}
path="/"
label={<Trans>Dashboard</Trans>}
icon={<Icon name="ph:squares-four"/>}
tab={props.tabs}
/>
<MenuItem
path="/library"
label={<Trans>Library</Trans>}
icon={<Icon name="ph:package"/>}
path="/calendar"
label={<Trans>Calendar</Trans>}
icon={<Icon name="ph:calendar-dots"/>}
tab={props.tabs}
/>
</>
}
<MenuItem
path="/settings"
label={<Trans>Settings</Trans>}
icon={<Icon name="ph:gear"/>}
tab={props.tabs}
/>
<MenuItem
path="/tasks"
label={<Trans>Tasks</Trans>}
icon={<Icon name="ph:list-checks"/>}
tab={props.tabs}
/>
{props.tabs ? null : taskLists.map(({id, complete}) =>
<MenuItem
sub
key={id}
path={`/tasks/${id}`}
label={<Text>{id}</Text>}
striked={complete}
/>
)}
<View style={styles.fill}/>
{hasDevMenu &&
<>
<MenuItem
path="/design"
label={<Trans>Design</Trans>}
icon={<Icon name="ph:palette"/>}
tab={props.tabs}
/>
<MenuItem
path="/library"
label={<Trans>Library</Trans>}
icon={<Icon name="ph:package"/>}
tab={props.tabs}
/>
</>
}
<MenuItem
path="/settings"
label={<Trans>Settings</Trans>}
icon={<Icon name="ph:gear"/>}
tab={props.tabs}
/>
</View>
</ScrollView>
</View>
);
}

const stylesheet = createStyleSheet(theme => ({
bg: {
flex: 1,
backgroundColor: theme.colors.secondary,
},
root: {
flex: 1,
padding: 10,
borderRightWidth: StyleSheet.hairlineWidth,
borderColor: theme.colors.border,
backgroundColor: theme.colors.secondary,
},
rootTabs: {
flexDirection: 'row',
Expand Down
1 change: 0 additions & 1 deletion client/src/events/routes/ScreenCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default function ScreenCalendar() {
const stylesheet = createStyleSheet(_theme => ({
root: {
flex: 1,
marginHorizontal: 'auto',
paddingHorizontal: _theme.display.space5,
maxWidth: 800,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {Icon} from 'react-exo/icon';

const DEFAULT_MODEL = 'llama3-8b-8192';

export function Prompt() {
export function AiPrompt() {
const {i18n} = useLingui();
const [model] = useGroqModel();
const [apiKey] = useGroqKey();
Expand Down Expand Up @@ -46,7 +46,7 @@ export function Prompt() {
<TextInput
ref={input}
style={styles.input}
placeholder={apiKey ? t(i18n)`Ask anything...` : t(i18n)`Please set your Groq API Key`}
placeholder={apiKey ? t(i18n)`Ask anything... (or / for commands)` : t(i18n)`Please set your Groq API Key`}
placeholderTextColor={theme.colors.mutedForeground}
onSubmitEditing={(e) => e.nativeEvent.text && ai.prompt(e.nativeEvent.text, multiline)}
onKeyPress={(e) => ai.navigate(e, multiline ? () => setMultiline(false) : undefined)}
Expand Down
2 changes: 1 addition & 1 deletion client/src/home/hooks/useWeather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function useWeather() {
const [weather, setWeather] = useState<Weather | null>(null);
const [lat, lon] = useLocation();

// Update once
// Update when location changes
useEffect(() => {
console.log(lat, lon);
if (!lat || !lon) return;
Expand Down
4 changes: 2 additions & 2 deletions client/src/home/routes/ScreenHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {useClock} from 'home/hooks/useClock';
import {useWeather} from 'home/hooks/useWeather';
import {useDisplayName} from 'settings/hooks/useDisplayName';
import {getDayGreeting} from 'home/utils/time';
import {Prompt} from 'home/base/Prompt';
import {AiPrompt} from 'home/base/AiPrompt';
import {Page} from 'app/base/Page';

export default function ScreenHome() {
Expand All @@ -31,7 +31,7 @@ export default function ScreenHome() {
</Text>
</View>
}>
<Prompt/>
<AiPrompt/>
</Page>
);
}
Expand Down
27 changes: 13 additions & 14 deletions translations/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ msgstr "هل أنت متأكد أنك تريد إعادة تعيين سجل ال
msgid "Ask anything..."
msgstr "استعلام أي شيء..."

#: ../../client/src/home/base/AiPrompt.tsx:49
msgid "Ask anything... (or / for commands)"
msgstr ""

#: ../../client/src/settings/routes/ScreenSettings.tsx:100
#: ../../client/src/settings/routes/ScreenSettings.tsx:128
msgid "Auto"
msgstr "تلقائي"

#: ../../client/src/app/base/Menu.tsx:30
#: ../../client/src/settings/routes/ScreenSettings.tsx:250
#: ../../client/src/app/base/Menu.tsx:32
msgid "Calendar"
msgstr "تقويم"

Expand All @@ -60,7 +63,7 @@ msgstr "إعادة تعيين بيانات التقويم"
msgid "Dark"
msgstr "داكن"

#: ../../client/src/app/base/Menu.tsx:24
#: ../../client/src/app/base/Menu.tsx:26
msgid "Dashboard"
msgstr "لوحة المعلومات"

Expand Down Expand Up @@ -92,8 +95,7 @@ msgstr "حذف المسجيلات"
msgid "Delete the local database."
msgstr "حذف قاعدة البيانات المحلية."

#: ../../client/src/app/base/Menu.tsx:54
#: ../../client/src/dev/routes/ScreenDesign.tsx:11
#: ../../client/src/app/base/Menu.tsx:56
msgid "Design"
msgstr "تصميم"

Expand Down Expand Up @@ -149,8 +151,7 @@ msgstr "معرف النموذج Groq"
msgid "Language"
msgstr "لغة"

#: ../../client/src/app/base/Menu.tsx:60
#: ../../client/src/dev/routes/ScreenLibrary.tsx:15
#: ../../client/src/app/base/Menu.tsx:62
msgid "Library"
msgstr "مكتبة"

Expand All @@ -162,7 +163,7 @@ msgstr "فاتح"
msgid "Manage your settings"
msgstr "إدارة إعداداتك"

#: ../../client/src/home/base/Prompt.tsx:49
#: ../../client/src/home/base/AiPrompt.tsx:49
msgid "Please set your Groq API Key"
msgstr "يرجى تعيين مفتاح API Groq الخاص بك"

Expand Down Expand Up @@ -202,13 +203,11 @@ msgstr "إختر وضع التطبيق."
msgid "Set a display name for yourself."
msgstr "أعيد تعيين اسم العرض ليستعلمك."

#: ../../client/src/app/base/Menu.tsx:68
#: ../../client/src/settings/routes/ScreenSettings.tsx:55
#: ../../client/src/app/base/Menu.tsx:70
msgid "Settings"
msgstr "إعدادات"

#: ../../client/src/app/base/Menu.tsx:36
#: ../../client/src/tasks/routes/TaskList.tsx:13
#: ../../client/src/app/base/Menu.tsx:38
msgid "Tasks"
msgstr "مسجيلات"

Expand All @@ -220,11 +219,11 @@ msgstr "حرارة"
msgid "Theme"
msgstr "وضع"

#: ../../client/src/home/routes/ScreenHome.tsx:23
#: ../../client/src/home/routes/ScreenHome.tsx:22
msgid "Welcome, {displayName}"
msgstr "مرحبا بك {displayName}"

#: ../../client/src/home/routes/ScreenHome.tsx:24
#: ../../client/src/home/routes/ScreenHome.tsx:23
msgid "Welcome, Human"
msgstr "مرحبا بك الشخص"

Expand Down
27 changes: 13 additions & 14 deletions translations/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ msgstr "Are you sure you want to reset your prompt history?"
msgid "Ask anything..."
msgstr "Ask anything..."

#: ../../client/src/home/base/AiPrompt.tsx:49
msgid "Ask anything... (or / for commands)"
msgstr "Ask anything... (or / for commands)"

#: ../../client/src/settings/routes/ScreenSettings.tsx:100
#: ../../client/src/settings/routes/ScreenSettings.tsx:128
msgid "Auto"
msgstr "Auto"

#: ../../client/src/app/base/Menu.tsx:30
#: ../../client/src/settings/routes/ScreenSettings.tsx:250
#: ../../client/src/app/base/Menu.tsx:32
msgid "Calendar"
msgstr "Calendar"

Expand All @@ -60,7 +63,7 @@ msgstr "Calendar Data Reset"
msgid "Dark"
msgstr "Dark"

#: ../../client/src/app/base/Menu.tsx:24
#: ../../client/src/app/base/Menu.tsx:26
msgid "Dashboard"
msgstr "Dashboard"

Expand Down Expand Up @@ -92,8 +95,7 @@ msgstr "Delete Prompts"
msgid "Delete the local database."
msgstr "Delete the local database."

#: ../../client/src/app/base/Menu.tsx:54
#: ../../client/src/dev/routes/ScreenDesign.tsx:11
#: ../../client/src/app/base/Menu.tsx:56
msgid "Design"
msgstr "Design"

Expand Down Expand Up @@ -149,8 +151,7 @@ msgstr "Groq Model ID"
msgid "Language"
msgstr "Language"

#: ../../client/src/app/base/Menu.tsx:60
#: ../../client/src/dev/routes/ScreenLibrary.tsx:15
#: ../../client/src/app/base/Menu.tsx:62
msgid "Library"
msgstr "Library"

Expand All @@ -162,7 +163,7 @@ msgstr "Light"
msgid "Manage your settings"
msgstr "Manage your settings"

#: ../../client/src/home/base/Prompt.tsx:49
#: ../../client/src/home/base/AiPrompt.tsx:49
msgid "Please set your Groq API Key"
msgstr "Please set your Groq API Key"

Expand Down Expand Up @@ -202,13 +203,11 @@ msgstr "Select the theme for the app."
msgid "Set a display name for yourself."
msgstr "Set a display name for yourself."

#: ../../client/src/app/base/Menu.tsx:68
#: ../../client/src/settings/routes/ScreenSettings.tsx:55
#: ../../client/src/app/base/Menu.tsx:70
msgid "Settings"
msgstr "Settings"

#: ../../client/src/app/base/Menu.tsx:36
#: ../../client/src/tasks/routes/TaskList.tsx:13
#: ../../client/src/app/base/Menu.tsx:38
msgid "Tasks"
msgstr "Tasks"

Expand All @@ -220,11 +219,11 @@ msgstr "Temperature"
msgid "Theme"
msgstr "Theme"

#: ../../client/src/home/routes/ScreenHome.tsx:23
#: ../../client/src/home/routes/ScreenHome.tsx:22
msgid "Welcome, {displayName}"
msgstr "Welcome, {displayName}"

#: ../../client/src/home/routes/ScreenHome.tsx:24
#: ../../client/src/home/routes/ScreenHome.tsx:23
msgid "Welcome, Human"
msgstr "Welcome, Human"

Expand Down
Loading

0 comments on commit dd3b9e8

Please sign in to comment.