wip: make less shit

This commit is contained in:
Dax Raad
2025-09-03 13:10:57 -04:00
parent 59e550271d
commit 48a79b1173
6 changed files with 38 additions and 48 deletions

View File

@@ -3,17 +3,17 @@ import { useAuthSession } from "~/context/auth.session"
import { IconLogo } from "../component/icon"
import { withActor } from "~/context/auth.withActor"
import "./workspace.css"
import { query, action, redirect, createAsync, RouteSectionProps } from "@solidjs/router"
import { query, action, redirect, createAsync, RouteSectionProps, Navigate, useNavigate, useParams, A } from "@solidjs/router"
import { User } from "@opencode/cloud-core/user.js"
import { Actor } from "@opencode/cloud-core/actor.js"
const getUserInfo = query(async () => {
const getUserInfo = query(async (workspaceID: string) => {
"use server"
return withActor(async () => {
const actor = Actor.assert("user")
const user = await User.fromID(actor.properties.userID)
return { user }
})
}, workspaceID)
}, "userInfo")
const logout = action(async () => {
@@ -30,16 +30,15 @@ const logout = action(async () => {
})
export default function WorkspaceLayout(props: RouteSectionProps) {
const userInfo = createAsync(() => getUserInfo(), {
deferStream: true,
})
const params = useParams()
const userInfo = createAsync(() => getUserInfo(params.id))
return (
<main data-page="workspace">
<header data-component="workspace-header">
<div data-slot="header-brand">
<a href="/" data-component="site-title">
<A href="/" data-component="site-title">
<IconLogo />
</a>
</A>
</div>
<div data-slot="header-actions">
<span>{userInfo()?.user.email}</span>