Skip to content

Commit

Permalink
core and hook
Browse files Browse the repository at this point in the history
  • Loading branch information
raykyri committed Nov 4, 2024
1 parent dfc71ee commit a5f6e87
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/app/features/home/screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ChevronDown, ChevronUp, X } from '@tamagui/lucide-icons'
import { useState } from 'react'
import { Platform } from 'react-native'
import { useLink } from 'solito/navigation'
import { useCanvas } from '@canvas-js/hooks'

export function HomeScreen({ pagesMode = false }: { pagesMode?: boolean }) {
const linkTarget = pagesMode ? '/pages-example-user' : '/user'
Expand All @@ -30,6 +31,37 @@ export function HomeScreen({ pagesMode = false }: { pagesMode?: boolean }) {
{ username: "raymond", user: "Raymond", item: "Intermezzo" },
])

const { app } = useCanvas(null, {
contract: {
models: {
profiles: {
did: "primary",
name: "string",
items: "@items[]", // TODO
image: "string?", // TODO
},
items: {
id: "primary",
name: "string",
image: "string?",
children: "@items[]", // TODO
parent: "@items", // TODO
}
},
actions: {
createProfile(db, name) {
const { did } = this
db.create("profiles", { did, name, items: [], image: null })
},
updateProfile(db, name) {
const { did } = this
db.update("profiles", { did, name })
}
}
},
topic: "refs.canvas.xyz"
})

return (
<YStack f={1} jc="center" ai="center" gap="$8" p="$4" bg="$background">
<XStack
Expand Down

0 comments on commit a5f6e87

Please sign in to comment.