type checks

This commit is contained in:
Dax Raad
2025-11-11 01:56:01 -05:00
parent 995b23787c
commit d685aa38ef
15 changed files with 24 additions and 24 deletions

View File

@@ -19,7 +19,7 @@ const getUserEmail = query(async (workspaceID: string) => {
export default function WorkspaceLayout(props: RouteSectionProps) { export default function WorkspaceLayout(props: RouteSectionProps) {
const params = useParams() const params = useParams()
const userEmail = createAsync(() => getUserEmail(params.id)) const userEmail = createAsync(() => getUserEmail(params.id!))
return ( return (
<main data-page="workspace"> <main data-page="workspace">
<Link rel="icon" type="image/svg+xml" href="/favicon-zen.svg" /> <Link rel="icon" type="image/svg+xml" href="/favicon-zen.svg" />

View File

@@ -5,7 +5,7 @@ import "./[id].css"
export default function WorkspaceLayout(props: RouteSectionProps) { export default function WorkspaceLayout(props: RouteSectionProps) {
const params = useParams() const params = useParams()
const userInfo = createAsync(() => querySessionInfo(params.id)) const userInfo = createAsync(() => querySessionInfo(params.id!))
return ( return (
<main data-page="workspace"> <main data-page="workspace">

View File

@@ -27,7 +27,7 @@ const createSessionUrl = action(async (workspaceID: string, returnUrl: string) =
export function BillingSection() { export function BillingSection() {
const params = useParams() const params = useParams()
// ORIGINAL CODE - COMMENTED OUT FOR TESTING // ORIGINAL CODE - COMMENTED OUT FOR TESTING
const billingInfo = createAsync(() => queryBillingInfo(params.id)) const billingInfo = createAsync(() => queryBillingInfo(params.id!))
const checkoutAction = useAction(createCheckoutUrl) const checkoutAction = useAction(createCheckoutUrl)
const checkoutSubmission = useSubmission(createCheckoutUrl) const checkoutSubmission = useSubmission(createCheckoutUrl)
const sessionAction = useAction(createSessionUrl) const sessionAction = useAction(createSessionUrl)
@@ -51,7 +51,7 @@ export function BillingSection() {
const amount = parseInt(store.addBalanceAmount) const amount = parseInt(store.addBalanceAmount)
const baseUrl = window.location.href const baseUrl = window.location.href
const checkout = await checkoutAction(params.id, amount, baseUrl, baseUrl) const checkout = await checkoutAction(params.id!, amount, baseUrl, baseUrl)
if (checkout && checkout.data) { if (checkout && checkout.data) {
setStore("checkoutRedirecting", true) setStore("checkoutRedirecting", true)
window.location.href = checkout.data window.location.href = checkout.data
@@ -60,7 +60,7 @@ export function BillingSection() {
async function onClickSession() { async function onClickSession() {
const baseUrl = window.location.href const baseUrl = window.location.href
const sessionUrl = await sessionAction(params.id, baseUrl) const sessionUrl = await sessionAction(params.id!, baseUrl)
if (sessionUrl && sessionUrl.data) { if (sessionUrl && sessionUrl.data) {
setStore("sessionRedirecting", true) setStore("sessionRedirecting", true)
window.location.href = sessionUrl.data window.location.href = sessionUrl.data

View File

@@ -8,8 +8,8 @@ import { queryBillingInfo, querySessionInfo } from "../../common"
export default function () { export default function () {
const params = useParams() const params = useParams()
const userInfo = createAsync(() => querySessionInfo(params.id)) const userInfo = createAsync(() => querySessionInfo(params.id!))
const billingInfo = createAsync(() => queryBillingInfo(params.id)) const billingInfo = createAsync(() => queryBillingInfo(params.id!))
return ( return (
<div data-page="workspace-[id]"> <div data-page="workspace-[id]">

View File

@@ -30,7 +30,7 @@ export function MonthlyLimitSection() {
const params = useParams() const params = useParams()
const submission = useSubmission(setMonthlyLimit) const submission = useSubmission(setMonthlyLimit)
const [store, setStore] = createStore({ show: false }) const [store, setStore] = createStore({ show: false })
const billingInfo = createAsync(() => queryBillingInfo(params.id)) const billingInfo = createAsync(() => queryBillingInfo(params.id!))
let input: HTMLInputElement let input: HTMLInputElement

View File

@@ -19,7 +19,7 @@ const downloadReceipt = action(async (workspaceID: string, paymentID: string) =>
export function PaymentSection() { export function PaymentSection() {
const params = useParams() const params = useParams()
const payments = createAsync(() => getPaymentsInfo(params.id)) const payments = createAsync(() => getPaymentsInfo(params.id!))
const downloadReceiptAction = useAction(downloadReceipt) const downloadReceiptAction = useAction(downloadReceipt)
// DUMMY DATA FOR TESTING // DUMMY DATA FOR TESTING
@@ -89,7 +89,7 @@ export function PaymentSection() {
<td data-slot="payment-receipt"> <td data-slot="payment-receipt">
<button <button
onClick={async () => { onClick={async () => {
const receiptUrl = await downloadReceiptAction(params.id, payment.paymentID!) const receiptUrl = await downloadReceiptAction(params.id!, payment.paymentID!)
if (receiptUrl) { if (receiptUrl) {
window.open(receiptUrl, "_blank") window.open(receiptUrl, "_blank")
} }

View File

@@ -58,7 +58,7 @@ const setReload = action(async (form: FormData) => {
export function ReloadSection() { export function ReloadSection() {
const params = useParams() const params = useParams()
const billingInfo = createAsync(() => queryBillingInfo(params.id)) const billingInfo = createAsync(() => queryBillingInfo(params.id!))
const setReloadSubmission = useSubmission(setReload) const setReloadSubmission = useSubmission(setReload)
const reloadSubmission = useSubmission(reload) const reloadSubmission = useSubmission(reload)
const [store, setStore] = createStore({ const [store, setStore] = createStore({

View File

@@ -10,8 +10,8 @@ import { querySessionInfo, queryBillingInfo, createCheckoutUrl, formatBalance }
export default function () { export default function () {
const params = useParams() const params = useParams()
const userInfo = createAsync(() => querySessionInfo(params.id)) const userInfo = createAsync(() => querySessionInfo(params.id!))
const billingInfo = createAsync(() => queryBillingInfo(params.id)) const billingInfo = createAsync(() => queryBillingInfo(params.id!))
const checkoutAction = useAction(createCheckoutUrl) const checkoutAction = useAction(createCheckoutUrl)
const checkoutSubmission = useSubmission(createCheckoutUrl) const checkoutSubmission = useSubmission(createCheckoutUrl)
const [store, setStore] = createStore({ const [store, setStore] = createStore({
@@ -21,7 +21,7 @@ export default function () {
async function onClickCheckout() { async function onClickCheckout() {
const baseUrl = window.location.href const baseUrl = window.location.href
const checkout = await checkoutAction(params.id, billingInfo()!.reloadAmount, baseUrl, baseUrl) const checkout = await checkoutAction(params.id!, billingInfo()!.reloadAmount, baseUrl, baseUrl)
if (checkout && checkout.data) { if (checkout && checkout.data) {
setStore("checkoutRedirecting", true) setStore("checkoutRedirecting", true)
window.location.href = checkout.data window.location.href = checkout.data

View File

@@ -45,7 +45,7 @@ const listKeys = query(async (workspaceID: string) => {
export function KeySection() { export function KeySection() {
const params = useParams() const params = useParams()
const keys = createAsync(() => listKeys(params.id)) const keys = createAsync(() => listKeys(params.id!))
const submission = useSubmission(createKey) const submission = useSubmission(createKey)
const [store, setStore] = createStore({ show: false }) const [store, setStore] = createStore({ show: false })

View File

@@ -209,7 +209,7 @@ const roleOptions = [
export function MemberSection() { export function MemberSection() {
const params = useParams() const params = useParams()
const data = createAsync(() => listMembers(params.id)) const data = createAsync(() => listMembers(params.id!))
const submission = useSubmission(inviteMember) const submission = useSubmission(inviteMember)
const [store, setStore] = createStore({ const [store, setStore] = createStore({
show: false, show: false,
@@ -328,7 +328,7 @@ export function MemberSection() {
{(member) => ( {(member) => (
<MemberRow <MemberRow
member={member} member={member}
workspaceID={params.id} workspaceID={params.id!}
actorID={data()!.actorID} actorID={data()!.actorID}
actorRole={data()!.actorRole} actorRole={data()!.actorRole}
/> />

View File

@@ -52,8 +52,8 @@ const updateModel = action(async (form: FormData) => {
export function ModelSection() { export function ModelSection() {
const params = useParams() const params = useParams()
const modelsInfo = createAsync(() => getModelsInfo(params.id)) const modelsInfo = createAsync(() => getModelsInfo(params.id!))
const userInfo = createAsync(() => querySessionInfo(params.id)) const userInfo = createAsync(() => querySessionInfo(params.id!))
const modelsWithLab = createMemo(() => { const modelsWithLab = createMemo(() => {
const info = modelsInfo() const info = modelsInfo()

View File

@@ -21,8 +21,8 @@ const listKeys = query(async (workspaceID: string) => {
export function NewUserSection() { export function NewUserSection() {
const params = useParams() const params = useParams()
const [copiedKey, setCopiedKey] = createSignal(false) const [copiedKey, setCopiedKey] = createSignal(false)
const keys = createAsync(() => listKeys(params.id)) const keys = createAsync(() => listKeys(params.id!))
const usage = createAsync(() => getUsageInfo(params.id)) const usage = createAsync(() => getUsageInfo(params.id!))
const isNew = createMemo(() => { const isNew = createMemo(() => {
const keysList = keys() const keysList = keys()
const usageList = usage() const usageList = usage()

View File

@@ -54,7 +54,7 @@ const listProviders = query(async (workspaceID: string) => {
function ProviderRow(props: { provider: Provider }) { function ProviderRow(props: { provider: Provider }) {
const params = useParams() const params = useParams()
const providers = createAsync(() => listProviders(params.id)) const providers = createAsync(() => listProviders(params.id!))
const saveSubmission = useSubmission(saveProvider, ([fd]) => fd.get("provider")?.toString() === props.provider.key) const saveSubmission = useSubmission(saveProvider, ([fd]) => fd.get("provider")?.toString() === props.provider.key)
const removeSubmission = useSubmission( const removeSubmission = useSubmission(
removeProvider, removeProvider,

View File

@@ -46,7 +46,7 @@ const updateWorkspace = action(async (form: FormData) => {
export function SettingsSection() { export function SettingsSection() {
const params = useParams() const params = useParams()
const workspaceInfo = createAsync(() => getWorkspaceInfo(params.id)) const workspaceInfo = createAsync(() => getWorkspaceInfo(params.id!))
const submission = useSubmission(updateWorkspace) const submission = useSubmission(updateWorkspace)
const [store, setStore] = createStore({ show: false }) const [store, setStore] = createStore({ show: false })

View File

@@ -15,7 +15,7 @@ const getUsageInfo = query(async (workspaceID: string) => {
export function UsageSection() { export function UsageSection() {
const params = useParams() const params = useParams()
// ORIGINAL CODE - COMMENTED OUT FOR TESTING // ORIGINAL CODE - COMMENTED OUT FOR TESTING
const usage = createAsync(() => getUsageInfo(params.id)) const usage = createAsync(() => getUsageInfo(params.id!))
// DUMMY DATA FOR TESTING // DUMMY DATA FOR TESTING
// const usage = () => [ // const usage = () => [