-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2b6001
commit 2b8b7ad
Showing
38 changed files
with
1,295 additions
and
1,188 deletions.
There are no files selected for viewing
24 changes: 1 addition & 23 deletions
24
apps/dashboard/src/app/(dashboard)/offline/[id]/edit-card.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,61 @@ | ||
import { authOptions } from "@dotkomonline/auth/src/dashboard.app" | ||
import { Card, Container, Flex, Text, Title } from "@mantine/core" | ||
import { getServerSession } from "next-auth" | ||
import { redirect } from "next/navigation" | ||
import { SignInButton } from "./SignInButton" | ||
"use client" | ||
import { ImageSchema } from "@dotkomonline/types" | ||
import { z } from "zod" | ||
import { createImageInput, useFormBuilder } from "./form" | ||
|
||
import { TestComp } from "./testcomp" | ||
const FormValidationSchema = z.object({ | ||
image: ImageSchema, | ||
fileId: z.string(), | ||
}) | ||
type FormValidationSchema = z.infer<typeof FormValidationSchema> | ||
|
||
export default async function DashboardPage() { | ||
const session = await getServerSession(authOptions) | ||
if (session !== null) { | ||
redirect("/event") | ||
} | ||
export default function DashboardPage() { | ||
const Form = useFormBuilder({ | ||
schema: FormValidationSchema, | ||
label: "Last opp bilde", | ||
defaultValues: { | ||
image: { | ||
id: "01HX4CPYMNFNYDKNZ2WW7SEKA3", | ||
crop: { | ||
left: 21, | ||
top: 129, | ||
width: 335, | ||
height: 232, | ||
}, | ||
assetId: | ||
"00d9565a-d6be-4b3e-bede-89957ca43f0chei.png30d674cb-e251-49a7-9cc1-81d857a712ce", | ||
} | ||
}, | ||
fields: { | ||
image: createImageInput({ | ||
label: "Bilde", | ||
placeholder: "Last opp", | ||
}), | ||
}, | ||
onSubmit: async (data) => { | ||
console.log("submitting form", data) | ||
}, | ||
}) | ||
|
||
return ( | ||
<Flex justify="center" align="center"> | ||
<Container mt="xl"> | ||
<Card> | ||
<Flex direction="column" gap="2"> | ||
<Title>Logg inn</Title> | ||
<Text>Vennligst logg inn for å bruke Monoweb Admin</Text> | ||
|
||
<SignInButton /> | ||
</Flex> | ||
</Card> | ||
</Container> | ||
</Flex> | ||
<Form /> | ||
) | ||
} | ||
|
||
// export default async function DashboardPage() { | ||
// return <TestComp /> | ||
|
||
// https://s3.eu-north-1.amazonaws.com/cdn.staging.online.ntnu.no/testing/testing/Screenshot%202023-06-25%20at%2012.43.43.png578d7818-88be-4087-a428-32c89a3cf994 | ||
|
||
// { | ||
// "id": "01HX2ERFQH8GGRVPGVJ8ZYCYMM", | ||
// "createdAt": "2024-05-04T18:44:44.357Z", | ||
// "assetUri": "78786155-af3e-43d4-bf7c-35ae183d792ehei.png1b16623e-fc87-4ca2-930a-048454269d25", | ||
// "crop": { | ||
// "x": 46.414062499999936, | ||
// "y": 317.6171875, | ||
// "width": 421.984375, | ||
// "height": 237.4609375, | ||
// "unit": "px" | ||
// } | ||
// } | ||
|
||
// https://onli.no/cdn-cgi/image/trim=1000;0;0;0/https://s3.eu-north-1.amazonaws.com/cdn.staging.online.ntnu.no/testing/78786155-af3e-43d4-bf7c-35ae183d792ehei.png1b16623e-fc87-4ca2-930a-048454269d25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.