-
Notifications
You must be signed in to change notification settings - Fork 3
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
ce97254
commit 80091ea
Showing
32 changed files
with
1,870 additions
and
426 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use server'; | ||
|
||
import { revalidatePath } from 'next/cache'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/require-await | ||
export const revalidateDashboard = async () => { | ||
revalidatePath('/dashboard'); | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/require-await | ||
export const revalidateFromClient = async (route: string) => { | ||
revalidatePath(route); | ||
}; |
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 was deleted.
Oops, something went wrong.
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
8 changes: 0 additions & 8 deletions
8
apps/web/src/app/(main)/form/_actions/refresh-dashboard-after-deletion.ts
This file was deleted.
Oops, something went wrong.
94 changes: 94 additions & 0 deletions
94
apps/web/src/app/(main)/onboarding/form/code-example-step.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { | ||
Tabs, | ||
TabsContent, | ||
TabsList, | ||
TabsTrigger, | ||
} from '@formbase/ui/primitives/tabs'; | ||
import { cn } from '@formbase/ui/utils/cn'; | ||
|
||
import { CopyButton } from '~/components/copy-button'; | ||
import { highlightCode } from '~/lib/highlight-code'; | ||
|
||
import SendFormSubmissionButton from './send-submission-button'; | ||
|
||
type CodeExampleStepProps = { | ||
formId: string | null; | ||
}; | ||
|
||
export const CodeExampleStep = async ({ formId }: CodeExampleStepProps) => { | ||
const htmlCode = await highlightCode(`<form | ||
action="https://formbase.dev/s/${formId ?? 'abcdefghijkl'}" method="POST" | ||
enctype="multipart/form-data" | ||
> | ||
<input type="text" name="name" /> | ||
<input type="email" name="email" /> | ||
<textarea name="message"></textarea> | ||
<button type="submit">Submit</button> | ||
</form>`); | ||
|
||
const reactCode = | ||
await highlightCode(`export default function FormbaseForm() { | ||
return ( | ||
<form | ||
action="https://formbase.dev/s/${formId ?? 'abcdefghijkl'}" | ||
method="POST" | ||
encType="multipart/form-data" | ||
> | ||
<input type="text" name="name" /> | ||
<input type="email" name="email" /> | ||
<textarea name="message"></textarea> | ||
<button type="submit">Submit</button> | ||
</form> | ||
); | ||
}`); | ||
|
||
return ( | ||
<div | ||
className={cn('-mt-0.5', { | ||
'pointer-events-none opacity-50 select-none': formId === null, | ||
})} | ||
> | ||
<h2 className="text-xl font-semibold">Send a submission</h2> | ||
<div className="text-gray-600 dark:text-muted-foreground mt-2"> | ||
<div className="space-y-4"> | ||
<p>Use the code below to recieve your first submission</p> | ||
|
||
<Tabs defaultValue="html"> | ||
<TabsList> | ||
<TabsTrigger value="html">HTML</TabsTrigger> | ||
<TabsTrigger value="react">React</TabsTrigger> | ||
</TabsList> | ||
<TabsContent value="html" className="relative"> | ||
<div | ||
className="mt-4 rounded-md" | ||
dangerouslySetInnerHTML={{ | ||
__html: htmlCode, | ||
}} | ||
/> | ||
<CopyButton | ||
text={htmlCode} | ||
className="absolute top-4 text-white right-4" | ||
/> | ||
</TabsContent> | ||
<TabsContent value="react" className="relative"> | ||
<div | ||
className="mt-4 rounded-md" | ||
dangerouslySetInnerHTML={{ | ||
__html: reactCode, | ||
}} | ||
/> | ||
<CopyButton | ||
text={reactCode} | ||
className="absolute top-4 text-white right-4" | ||
/> | ||
</TabsContent> | ||
</Tabs> | ||
|
||
<SendFormSubmissionButton formId={formId} /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.