mirror of
https://github.com/kennethnym/freya
synced 2026-06-23 01:44:55 +01:00
chore: save wip changes
This commit is contained in:
@@ -6,12 +6,16 @@
|
||||
"build": {
|
||||
"development": {
|
||||
"developmentClient": true,
|
||||
"distribution": "internal"
|
||||
"distribution": "internal",
|
||||
"ios": {
|
||||
"image": "sdk-56"
|
||||
}
|
||||
},
|
||||
"development-simulator": {
|
||||
"extends": "development",
|
||||
"ios": {
|
||||
"simulator": "true"
|
||||
"image": "sdk-56",
|
||||
"simulator": true
|
||||
}
|
||||
},
|
||||
"preview": {
|
||||
|
||||
@@ -1,56 +1,61 @@
|
||||
{
|
||||
"name": "freya-client",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"main": "expo-router/entry",
|
||||
"scripts": {
|
||||
"start": "./scripts/run-dev-server.sh",
|
||||
"reset-project": "node ./scripts/reset-project.js",
|
||||
"android": "expo start --android",
|
||||
"ios": "expo start --ios",
|
||||
"web": "expo start --web",
|
||||
"lint": "expo lint",
|
||||
"build:ios": "bunx eas-cli build --profile development --platform ios --non-interactive",
|
||||
"build:ios-simulator": "bunx eas-cli build --profile development-simulator --platform ios --non-interactive",
|
||||
"debugger": "bun run scripts/open-debugger.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo-google-fonts/inter": "^0.4.2",
|
||||
"@expo-google-fonts/source-serif-4": "^0.4.1",
|
||||
"@expo/vector-icons": "^15.0.3",
|
||||
"@json-render/react-native": "^0.13.0",
|
||||
"@tanstack/react-query": "^5.90.21",
|
||||
"expo": "^56.0.0",
|
||||
"expo-constants": "~56.0.18",
|
||||
"expo-dev-client": "~56.0.20",
|
||||
"expo-font": "~56.0.7",
|
||||
"expo-haptics": "~56.0.3",
|
||||
"expo-image": "~56.0.11",
|
||||
"expo-linking": "~56.0.14",
|
||||
"expo-location": "~56.0.18",
|
||||
"expo-router": "~56.2.11",
|
||||
"expo-splash-screen": "~56.0.10",
|
||||
"expo-status-bar": "~56.0.4",
|
||||
"expo-symbols": "~56.0.6",
|
||||
"expo-system-ui": "~56.0.5",
|
||||
"expo-web-browser": "~56.0.5",
|
||||
"react": "19.2.3",
|
||||
"react-dom": "19.2.3",
|
||||
"react-native": "0.85.3",
|
||||
"react-native-gesture-handler": "~2.31.1",
|
||||
"react-native-reanimated": "4.3.1",
|
||||
"react-native-safe-area-context": "~5.7.0",
|
||||
"react-native-screens": "4.25.2",
|
||||
"react-native-svg": "15.15.4",
|
||||
"react-native-web": "~0.21.0",
|
||||
"react-native-worklets": "0.8.3",
|
||||
"twrnc": "^4.16.0",
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "~19.2.10",
|
||||
"eslint": "^9.25.0",
|
||||
"eslint-config-expo": "~56.0.4",
|
||||
"typescript": "~6.0.3"
|
||||
}
|
||||
"name": "freya-client",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"main": "expo-router/entry",
|
||||
"scripts": {
|
||||
"start": "./scripts/run-dev-server.sh",
|
||||
"reset-project": "node ./scripts/reset-project.js",
|
||||
"android": "expo start --android",
|
||||
"ios": "expo start --ios",
|
||||
"web": "expo start --web",
|
||||
"lint": "expo lint",
|
||||
"build:ios": "bunx eas-cli build --profile development --platform ios --non-interactive",
|
||||
"build:ios-simulator": "bunx eas-cli build --profile development-simulator --platform ios --non-interactive",
|
||||
"debugger": "bun run scripts/open-debugger.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo-google-fonts/inter": "^0.4.2",
|
||||
"@expo-google-fonts/source-serif-4": "^0.4.1",
|
||||
"@expo/vector-icons": "^15.0.3",
|
||||
"@freya/core": "workspace:*",
|
||||
"@json-render/react-native": "^0.13.0",
|
||||
"@shopify/flash-list": "2.0.2",
|
||||
"@tanstack/react-query": "^5.90.21",
|
||||
"arktype": "^2.2.1",
|
||||
"expo": "^56.0.0",
|
||||
"expo-blur": "~56.0.3",
|
||||
"expo-constants": "~56.0.18",
|
||||
"expo-dev-client": "~56.0.20",
|
||||
"expo-font": "~56.0.7",
|
||||
"expo-glass-effect": "~0.1.10",
|
||||
"expo-haptics": "~56.0.3",
|
||||
"expo-image": "~56.0.11",
|
||||
"expo-linking": "~56.0.14",
|
||||
"expo-location": "~56.0.18",
|
||||
"expo-router": "~56.2.11",
|
||||
"expo-splash-screen": "~56.0.10",
|
||||
"expo-status-bar": "~56.0.4",
|
||||
"expo-symbols": "~56.0.6",
|
||||
"expo-system-ui": "~56.0.5",
|
||||
"expo-web-browser": "~56.0.5",
|
||||
"react": "19.2.3",
|
||||
"react-dom": "19.2.3",
|
||||
"react-native": "0.85.3",
|
||||
"react-native-gesture-handler": "~2.31.1",
|
||||
"react-native-reanimated": "4.3.1",
|
||||
"react-native-safe-area-context": "~5.7.0",
|
||||
"react-native-screens": "4.25.2",
|
||||
"react-native-svg": "15.15.4",
|
||||
"react-native-web": "~0.21.0",
|
||||
"react-native-worklets": "0.8.3",
|
||||
"twrnc": "^4.16.0",
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "~19.2.10",
|
||||
"eslint": "^9.25.0",
|
||||
"eslint-config-expo": "~56.0.4",
|
||||
"typescript": "~6.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { BlurView } from "expo-blur"
|
||||
import { GlassView } from "expo-glass-effect"
|
||||
import { Link } from "expo-router"
|
||||
import { Pressable } from "react-native"
|
||||
import { Pressable, View, Text, TextInput } from "react-native"
|
||||
import { SafeAreaView } from "react-native-safe-area-context"
|
||||
import tw from "twrnc"
|
||||
|
||||
@@ -11,7 +13,9 @@ import { SerifText } from "@/components/ui/serif-text"
|
||||
|
||||
export default function HomeScreen() {
|
||||
return (
|
||||
<SafeAreaView style={tw`bg-stone-100 dark:bg-stone-900 flex-1 px-5 pt-6 gap-4`}>
|
||||
<SafeAreaView
|
||||
style={tw`bg-stone-100 dark:bg-stone-900 flex-1 px-5 pt-6 gap-4 relative dark:text-stone-100`}
|
||||
>
|
||||
<FeedCard>
|
||||
<SerifText style={tw`text-4xl`}>Hello world asdsadsa</SerifText>
|
||||
<SansSerifText style={tw`text-4xl font-bold`}>Hello world</SansSerifText>
|
||||
@@ -23,6 +27,17 @@ export default function HomeScreen() {
|
||||
<SansSerifText style={tw`text-teal-600`}>View component library</SansSerifText>
|
||||
</Pressable>
|
||||
</Link>
|
||||
<View style={tw`absolute bottom-10 left-0 right-0 px-3`}>
|
||||
<BlurView
|
||||
style={tw`flex flex-row w-full py-2 pl-4 pr-2 bg-stone-800 border border-stone-700 rounded-full overflow-hidden`}
|
||||
>
|
||||
<TextInput
|
||||
style={tw`text-stone-300 dark:text-stone-200 flex-1`}
|
||||
placeholder="Message Freya..."
|
||||
/>
|
||||
<Button style={tw`size-8 p-0`} leadingIcon={<Button.Icon name="arrow-up" />} />
|
||||
</BlurView>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ function ButtonIcon({ name }: ButtonIconProps) {
|
||||
}
|
||||
|
||||
type ButtonProps = Omit<PressableProps, "children" | "style"> & {
|
||||
label: string
|
||||
label?: string
|
||||
leadingIcon?: React.ReactNode
|
||||
style?: StyleProp<ViewStyle>
|
||||
trailingIcon?: React.ReactNode
|
||||
@@ -24,14 +24,17 @@ type ButtonProps = Omit<PressableProps, "children" | "style"> & {
|
||||
export function Button({ style, label, leadingIcon, trailingIcon, ...props }: ButtonProps) {
|
||||
const hasIcons = leadingIcon != null || trailingIcon != null
|
||||
|
||||
const textElement = (
|
||||
const textElement = label ? (
|
||||
<SansSerifText style={tw`text-stone-100 dark:text-stone-200 font-medium`}>
|
||||
{label}
|
||||
</SansSerifText>
|
||||
)
|
||||
) : null
|
||||
|
||||
return (
|
||||
<Pressable style={[tw`rounded-full bg-teal-600 px-4 py-3 w-fit`, style]} {...props}>
|
||||
<Pressable
|
||||
style={[tw`rounded-full bg-teal-600 px-4 py-3 w-fit flex items-center justify-center`, style]}
|
||||
{...props}
|
||||
>
|
||||
{hasIcons ? (
|
||||
<View style={tw`flex-row items-center gap-1.5`}>
|
||||
{leadingIcon}
|
||||
|
||||
23
apps/freya-client/src/conversations/conversation-view.tsx
Normal file
23
apps/freya-client/src/conversations/conversation-view.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { FlashList } from "@shopify/flash-list";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import {
|
||||
useListConversationEntriesQuery,
|
||||
useDefaultConversationQuery,
|
||||
useListConversationsQuery,
|
||||
} from "./queries";
|
||||
|
||||
export function ConversationView() {
|
||||
const { data: conversation } = useQuery(useDefaultConversationQuery());
|
||||
const { data: entries } = useQuery(
|
||||
useListConversationEntriesQuery(conversation?.id),
|
||||
);
|
||||
|
||||
return (
|
||||
<FlashList
|
||||
data={entries ?? []}
|
||||
keyExtractor={(item) => item.id}
|
||||
renderItem={({ item }) => <div key={item.id}>{item.kind}</div>}
|
||||
/>
|
||||
);
|
||||
}
|
||||
15
apps/freya-client/src/conversations/conversations.ts
Normal file
15
apps/freya-client/src/conversations/conversations.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {
|
||||
ConversationEntryKind,
|
||||
ConversationEntryPayload,
|
||||
ConversationEntryVisibility,
|
||||
} from "@freya/core"
|
||||
import { type } from "arktype"
|
||||
|
||||
export const ConversationEntry = type({
|
||||
id: "string.uuid",
|
||||
sequence: "number",
|
||||
kind: type.enumerated(...Object.values(ConversationEntryKind)),
|
||||
visibility: type.enumerated(...Object.values(ConversationEntryVisibility)),
|
||||
fileId: "string | null",
|
||||
payload: ConversationEntryPayload,
|
||||
})
|
||||
41
apps/freya-client/src/conversations/queries.ts
Normal file
41
apps/freya-client/src/conversations/queries.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { queryOptions, skipToken } from "@tanstack/react-query"
|
||||
import { type } from "arktype"
|
||||
|
||||
import { useApiClient } from "@/api/client"
|
||||
|
||||
import { ConversationEntry } from "./conversations"
|
||||
|
||||
const ConversationQueryResponse = type({
|
||||
entries: ConversationEntry.array(),
|
||||
})
|
||||
|
||||
export function useListConversationsQuery() {
|
||||
const api = useApiClient()
|
||||
return queryOptions({
|
||||
queryKey: ["conversations"],
|
||||
queryFn: async () =>
|
||||
api
|
||||
.request("/conversations", { method: "GET" })
|
||||
.then(([, json]) => ConversationQueryResponse.assert(json)),
|
||||
})
|
||||
}
|
||||
|
||||
export function useDefaultConversationQuery() {
|
||||
return queryOptions({
|
||||
...useListConversationsQuery(),
|
||||
select: (data) => (data.entries.length === 0 ? null : data.entries[0]),
|
||||
})
|
||||
}
|
||||
|
||||
export function useListConversationEntriesQuery(id?: string) {
|
||||
const api = useApiClient()
|
||||
return queryOptions({
|
||||
queryKey: ["conversations", id],
|
||||
queryFn: id
|
||||
? async () =>
|
||||
api
|
||||
.request(`/conversations/${id}/entries`, { method: "GET" })
|
||||
.then(([, json]) => ConversationQueryResponse.assert(json).entries)
|
||||
: skipToken,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user