Skip to content

Commit

Permalink
AI + Weather
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUltDev committed Jun 30, 2024
1 parent 66f6e21 commit d823b9d
Show file tree
Hide file tree
Showing 20 changed files with 1,286 additions and 162 deletions.
16 changes: 8 additions & 8 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,25 @@
"scripts": {
"dev": "conc -c 'auto' 'pnpm:start:*'",
"build": "conc -c 'auto' -g 'pnpm:build:*'",

"web": "open http://localhost:6206",
"ios": "react-native run-ios --no-packager",
"android": "react-native run-android --no-packager",
"macos": "react-native run-macos --no-packager --scheme EXO",
"windows": "react-native run-windows --no-packager",
"visionos": "react-native run-visionos --no-packager",

"build:web": "vite build",
"_build:ios": "react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
"_build:android": "react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
"_build:macos": "react-native bundle --entry-file index.js --platform macos --dev true --bundle-output dist/main.macos.jsbundle --assets-dest dist",
"_build:windows": "react-native bundle --entry-file index.js --platform windows --dev true --bundle-output dist/main.windows.bundle --assets-dest dist",
"_build:visionos": "react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.visionos.jsbundle --assets-dest dist",

"start:vite": "vite dev --port 6206",
"start:metro": "react-native rnx-start --reset-cache",

"generate": "pod install --project-directory=ios && pod install --project-directory=macos && pod install --project-directory=visionos",
"_postinstall": "pnpm generate"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.34",
"@callstack/react-native-visionos": "^0.73.0",
"@candlefinance/faster-image": "^1.4.3",
"@lingui/core": "^4.10.0",
Expand All @@ -38,15 +35,20 @@
"@react-native-community/slider": "^4.5.2",
"@react-native-picker/picker": "^2.7.5",
"@shopify/react-native-skia": "1.3.6",
"ai": "^3.2.15",
"burnt": "^0.12.2",
"design": "workspace:react-exo-ui@*",
"openmeteo": "^1.1.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-exo": "workspace:*",
"react-exo-ui": "workspace:*",
"react-native": "^0.73.0",
"react-native-gesture-handler": "^2.16.0",
"react-native-get-random-values": "^1.11.0",
"react-native-linear-gradient": "^2.8.3",
"react-native-macos": "^0.73.0",
"react-native-markdown-display": "^7.0.2",
"react-native-mmkv": "^2.12.2",
"react-native-navigation": "7.39.1",
"react-native-reanimated": "^3.8.1",
Expand All @@ -57,12 +59,10 @@
"react-native-unistyles": "^2.7.1",
"react-native-url-polyfill": "^2.0.0",
"react-native-video": "5.2.1",
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web": "^0.19.10",
"react-native-web-linear-gradient": "^1.1.2",
"react-native-windows": "^0.73.0",
"react-native": "^0.73.0",
"react-redux": "^9.1.2",
"react": "^18.2.0",
"rive-react-native": "^7.0.0",
"vite-plugin-node-polyfills": "^0.21.0"
},
Expand All @@ -80,10 +80,10 @@
"@rnx-kit/metro-plugin-typescript": "^0.4.4",
"@rnx-kit/metro-resolver-symlinks": "^0.1.36",
"@types/babel__core": "^7.20.5",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/react-native-video": "^5.0.20",
"@types/react-test-renderer": "^18.2.0",
"@types/react": "^18.2.0",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-tsconfig-paths-module-resolver": "^1.0.4",
"bundler": "workspace:*",
Expand Down
227 changes: 227 additions & 0 deletions client/src/app/base/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
import {memo} from 'react';
import {useStyles} from 'design/styles';
import {ScrollView, Platform} from 'react-native';
import Render from 'react-native-markdown-display';

export const Markdown = memo(({text}: {text: string}) => {
const {theme} = useStyles();

if (!text) {
return null;
}

return (
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={{height: '100%'}}>
<Render
mergeStyle={false}
style={{
body: {
gap: theme.display.space2,
fontFamily: theme.font.family,
letterSpacing: theme.font.spacing,
lineHeight: theme.typography.lineHeight2,
color: theme.colors.foreground,
},
// Headings
heading1: {
flexDirection: 'row',
fontSize: theme.typography.size8,
lineHeight: theme.typography.size8,
letterSpacing: theme.typography.letterSpacing8,
},
heading2: {
flexDirection: 'row',
fontSize: theme.typography.size6,
lineHeight: theme.typography.size6,
letterSpacing: theme.typography.letterSpacing6,
},
heading3: {
flexDirection: 'row',
fontSize: theme.typography.size4,
lineHeight: theme.typography.size4,
letterSpacing: theme.typography.letterSpacing4,
},
heading4: {
flexDirection: 'row',
fontSize: theme.typography.size3,
lineHeight: theme.typography.size3,
letterSpacing: theme.typography.letterSpacing3,
},
heading5: {
flexDirection: 'row',
fontSize: theme.typography.size2,
lineHeight: theme.typography.size2,
letterSpacing: theme.typography.letterSpacing2,
},
heading6: {
flexDirection: 'row',
fontSize: theme.typography.size1,
lineHeight: theme.typography.size1,
letterSpacing: theme.typography.letterSpacing1,
},
// Horizontal Rule
hr: {
height: 1,
backgroundColor: theme.colors.border,
},
// Emphasis
strong: {
fontWeight: 'bold',
},
em: {
fontStyle: 'italic',
},
s: {
textDecorationLine: 'line-through',
},
// Blockquotes
blockquote: {
backgroundColor: theme.colors.background,
borderColor: theme.colors.border,
borderLeftWidth: 4,
marginLeft: theme.display.space2,
paddingHorizontal: theme.display.space2,
borderRadius: theme.display.radius3,
},
// Lists
bullet_list: {},
ordered_list: {},
list_item: {
flexDirection: 'row',
justifyContent: 'flex-start',
},
// @pseudo class, does not have a unique render rule
bullet_list_icon: {
marginLeft: theme.display.space2,
marginRight: theme.display.space2,
},
// @pseudo class, does not have a unique render rule
bullet_list_content: {
flex: 1,
},
// @pseudo class, does not have a unique render rule
ordered_list_icon: {
marginLeft: theme.display.space2,
marginRight: theme.display.space2,
},
// @pseudo class, does not have a unique render rule
ordered_list_content: {
flex: 1,
},
// Code
code_inline: {
borderWidth: 1,
borderColor: theme.colors.border,
lineHeight: theme.font.labelHeight,
paddingVertical: theme.display.space1,
paddingHorizontal: theme.display.space2,
borderRadius: theme.display.radius3,
backgroundColor: theme.colors.card,
color: theme.colors.cardForeground,
...Platform.select({
ios: {
fontFamily: 'Courier',
},
default: {
fontFamily: 'monospace',
},
}),
},
code_block: {
borderWidth: 1,
borderColor: theme.colors.border,
borderRadius: theme.display.radius3,
padding: theme.display.space3,
backgroundColor: theme.colors.card,
color: theme.colors.cardForeground,
...Platform.select({
ios: {
fontFamily: 'Courier',
},
default: {
fontFamily: 'monospace',
},
}),
},
fence: {
borderWidth: 1,
borderColor: theme.colors.border,
borderRadius: theme.display.radius3,
padding: theme.display.space3,
backgroundColor: theme.colors.card,
color: theme.colors.cardForeground,
...Platform.select({
ios: {
fontFamily: 'Courier',
},
default: {
fontFamily: 'monospace',
},
}),
},
// Tables
table: {
borderWidth: 1,
borderColor: theme.colors.border,
borderRadius: theme.display.radius3,
},
thead: {},
tbody: {},
th: {
flex: 1,
padding: theme.display.space2,
},
tr: {
borderBottomWidth: 1,
borderColor: theme.colors.border,
flexDirection: 'row',
},
td: {
flex: 1,
padding: theme.display.space2,
},
// Links
link: {
textDecorationLine: 'underline',
},
blocklink: {
flex: 1,
borderColor: theme.colors.border,
borderBottomWidth: 1,
},
// Images
image: {
flex: 1,
},
// Text Output
text: {},
textgroup: {},
paragraph: {
width: '100%',
flexWrap: 'wrap',
flexDirection: 'row',
alignItems: 'flex-start',
justifyContent: 'flex-start',
marginVertical: theme.display.space3,
fontSize: theme.font.contentSize,
fontWeight: theme.font.contentWeight,
lineHeight: theme.font.contentHeight,
letterSpacing: theme.font.contentSpacing,
},
hardbreak: {
width: '100%',
height: 1,
},
softbreak: {},
// Never used but retained for completeness
pre: {},
inline: {},
span: {},
}}>
{text}
</Render>
</ScrollView>
);
})
31 changes: 1 addition & 30 deletions client/src/app/base/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function Menu(props: MenuProps) {
<MenuItem
path="/calendar"
label={t`Calendar`}
icon={<Icon name="ph:calendar"/>}
icon={<Icon name="ph:calendar-dots"/>}
tab={props.tabs}
/>
<MenuItem
Expand All @@ -48,35 +48,6 @@ export function Menu(props: MenuProps) {
/>
)}
<View style={styles.fill}/>
{false &&
<>
<MenuItem
path="/media/files"
label={t`Files`}
icon={<Icon name="ph:file-text"/>}
tab={props.tabs}
/>
<MenuItem
path="/media/photos"
label={t`Photos`}
icon={<Icon name="ph:image"/>}
tab={props.tabs}
/>
<MenuItem
path="/media/videos"
label={t`Videos`}
icon={<Icon name="ph:video"/>}
tab={props.tabs}
/>
<MenuItem
path="/media/audio"
label={t`Audio`}
icon={<Icon name="ph:music-notes-simple"/>}
tab={props.tabs}
/>
</>
}
<View style={styles.fill}/>
{hasDevMenu &&
<>
<MenuItem
Expand Down
Loading

0 comments on commit d823b9d

Please sign in to comment.