Skip to content

Commit

Permalink
fix: website name on public setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Bekacru committed Jan 13, 2024
1 parent 245c112 commit b6c0b68
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions apps/www/src/components/website-edit-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ export const EditWebsiteForm = ({
}) => {
const [isLoading, setIsLoading] = useState(false);
const [, setDeleteAlert] = useAtom(websiteDeleteModalAtom);
const form = useForm<z.infer<typeof websiteFormSchema>>({
resolver: zodResolver(websiteFormSchema),
});

async function onSubmit(values: z.infer<typeof websiteFormSchema>) {
setIsLoading(true);
try {
Expand Down Expand Up @@ -81,6 +79,15 @@ export const EditWebsiteForm = ({
scale: 1,
},
};

const form = useForm<z.infer<typeof websiteFormSchema>>({
resolver: zodResolver(websiteFormSchema),
defaultValues: {
title: "",
url: "",
public: true,
}
});
useEffect(() => {
if (data) {
const { setValue } = form;
Expand All @@ -91,6 +98,8 @@ export const EditWebsiteForm = ({
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data]);


return (
<AnimatePresence>
{isOpen ? (
Expand Down Expand Up @@ -221,12 +230,12 @@ export const EditWebsiteForm = ({
{field.value ? (
<div className=" flex items-center justify-between">
<Link
href={`${siteConfig.url}/${data?.id}`}
href={`${siteConfig.url}/s/${data?.id}`}
target="_blank"
className=" flex items-center gap-2 hover:underline decoration-blue-500"
>
<p className=" text-blue-600 text-sm">
{`${siteConfig.url}/`}
{`${siteConfig.url}/s/`}
<span className="">
{data?.id}
</span>{" "}
Expand All @@ -248,7 +257,7 @@ export const EditWebsiteForm = ({
onValueChange={(e) =>
field.onChange(e === "on" ? true : false)
}
value={field.value ? "on" : "off"}
value={!!field.value ? "on" : "off"}
>
<SelectTrigger>
<SelectValue />
Expand Down

0 comments on commit b6c0b68

Please sign in to comment.