|
@@ -27,8 +27,7 @@ import {
|
|
SelectValue,
|
|
SelectValue,
|
|
} from "@/components/ui/select"
|
|
} from "@/components/ui/select"
|
|
import { Textarea } from "@/components/ui/textarea"
|
|
import { Textarea } from "@/components/ui/textarea"
|
|
-import { useSiteContext } from "@app/hooks/useSiteContext"
|
|
|
|
-import api from "@app/api"
|
|
|
|
|
|
+import { useResourceContext } from "@app/hooks/useResourceContext"
|
|
|
|
|
|
const GeneralFormSchema = z.object({
|
|
const GeneralFormSchema = z.object({
|
|
name: z.string()
|
|
name: z.string()
|
|
@@ -50,12 +49,12 @@ const GeneralFormSchema = z.object({
|
|
type GeneralFormValues = z.infer<typeof GeneralFormSchema>
|
|
type GeneralFormValues = z.infer<typeof GeneralFormSchema>
|
|
|
|
|
|
export function GeneralForm() {
|
|
export function GeneralForm() {
|
|
- const { site, updateSite } = useSiteContext();
|
|
|
|
|
|
+ const { resource, updateResource } = useResourceContext();
|
|
|
|
|
|
const form = useForm<GeneralFormValues>({
|
|
const form = useForm<GeneralFormValues>({
|
|
resolver: zodResolver(GeneralFormSchema),
|
|
resolver: zodResolver(GeneralFormSchema),
|
|
defaultValues: {
|
|
defaultValues: {
|
|
- name: site?.name
|
|
|
|
|
|
+ name: resource?.name
|
|
},
|
|
},
|
|
mode: "onChange",
|
|
mode: "onChange",
|
|
})
|
|
})
|
|
@@ -66,7 +65,7 @@ export function GeneralForm() {
|
|
// })
|
|
// })
|
|
|
|
|
|
async function onSubmit(data: GeneralFormValues) {
|
|
async function onSubmit(data: GeneralFormValues) {
|
|
- await updateSite({ name: data.name });
|
|
|
|
|
|
+ await updateResource({ name: data.name });
|
|
}
|
|
}
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -82,7 +81,7 @@ export function GeneralForm() {
|
|
<Input {...field} />
|
|
<Input {...field} />
|
|
</FormControl>
|
|
</FormControl>
|
|
<FormDescription>
|
|
<FormDescription>
|
|
- This is the display name of the site.
|
|
|
|
|
|
+ This is the display name of the resource.
|
|
</FormDescription>
|
|
</FormDescription>
|
|
<FormMessage />
|
|
<FormMessage />
|
|
</FormItem>
|
|
</FormItem>
|
|
@@ -147,7 +146,7 @@ export function GeneralForm() {
|
|
URLs
|
|
URLs
|
|
</FormLabel>
|
|
</FormLabel>
|
|
<FormDescription className={cn(index !== 0 && "sr-only")}>
|
|
<FormDescription className={cn(index !== 0 && "sr-only")}>
|
|
- Add links to your website, blog, or social media profiles.
|
|
|
|
|
|
+ Add links to your webresource, blog, or social media profiles.
|
|
</FormDescription>
|
|
</FormDescription>
|
|
<FormControl>
|
|
<FormControl>
|
|
<Input {...field} />
|
|
<Input {...field} />
|
|
@@ -167,7 +166,7 @@ export function GeneralForm() {
|
|
Add URL
|
|
Add URL
|
|
</Button>
|
|
</Button>
|
|
</div> */}
|
|
</div> */}
|
|
- <Button type="submit">Update Site</Button>
|
|
|
|
|
|
+ <Button type="submit">Update Resource</Button>
|
|
</form>
|
|
</form>
|
|
</Form>
|
|
</Form>
|
|
)
|
|
)
|