Skip to content

Commit

Permalink
fix: 🐛 show form url only if published
Browse files Browse the repository at this point in the history
  • Loading branch information
gmpetrov committed Apr 15, 2024
1 parent fb47a44 commit b3e3d07
Showing 1 changed file with 35 additions and 38 deletions.
73 changes: 35 additions & 38 deletions apps/dashboard/components/BlablaFormEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ function Form({ formId }: Props) {
currentAccordionIndex: 1 as number | null,
});

const getFormData = useSWR<Prisma.PromiseReturnType<typeof getForm>>(
`/api/forms/${formId}`,
fetcher
);

const publishFormMutation = useSWRMutation<
Prisma.PromiseReturnType<typeof publishForm>
>(`/api/forms/${formId}/publish`, generateActionFetcher(HTTP_METHOD.POST));
Expand Down Expand Up @@ -416,45 +411,47 @@ function Form({ formId }: Props) {
alignItems: 'center',
})}
>
<Stack
sx={{
width: '100%',
position: 'absolute',
top: 2,
left: 2,
pt: 2,
pr: 2,
zIndex: 1,
}}
>
<Alert
variant="outlined"
size="sm"
startDecorator={
<LockRoundedIcon fontSize="sm" sx={{ opacity: 0.5 }} />
}
{!!query?.data?.publishedConfig && (
<Stack
sx={{
borderRadius: 'lg',
width: '100%',
py: 0.5,
px: 1,
position: 'absolute',
top: 2,
left: 2,
pt: 2,
pr: 2,
zIndex: 1,
}}
className="backdrop-blur-lg"
>
<Typography
level="body-sm"
endDecorator={<CopyButton text={formPublicUrl} />}
<Alert
variant="outlined"
size="sm"
startDecorator={
<LockRoundedIcon fontSize="sm" sx={{ opacity: 0.5 }} />
}
sx={{
borderRadius: 'lg',
width: '100%',
py: 0.5,
px: 1,
}}
className="backdrop-blur-lg"
>
<a
href={formPublicUrl}
className="hover:underline"
target="_blank"
<Typography
level="body-sm"
endDecorator={<CopyButton text={formPublicUrl} />}
>
{formPublicUrl}
</a>
</Typography>
</Alert>
</Stack>
<a
href={formPublicUrl}
className="hover:underline"
target="_blank"
>
{formPublicUrl}
</a>
</Typography>
</Alert>
</Stack>
)}
{draftConfig && (
<Stack
sx={{
Expand Down

0 comments on commit b3e3d07

Please sign in to comment.