diff --git a/src/pages/teams/[team]/manage/settings.tsx b/src/pages/teams/[team]/manage/settings.tsx index a7257902..38da147c 100644 --- a/src/pages/teams/[team]/manage/settings.tsx +++ b/src/pages/teams/[team]/manage/settings.tsx @@ -8,8 +8,8 @@ import { Select, Switch, Text, - TextInput, Textarea, + TextInput, Tooltip, useMantineColorScheme, useMantineTheme, @@ -71,6 +71,35 @@ const Settings = ({ data: tempData }: any) => { } }); }; + const handleSaveSocials = (e: any) => { + e.preventDefault(); + fetch(process.env.NEXT_PUBLIC_API_URL + `/buildteams/${data.id}/socials`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer ' + user.token, + }, + body: JSON.stringify({ socials: data.socials }), + }) + .then((res) => res.json()) + .then((res) => { + if (res.errors) { + showNotification({ + title: 'Update failed', + message: res.error, + color: 'red', + }); + } else { + showNotification({ + title: 'Socials updated', + message: 'All Data has been saved', + color: 'green', + icon: , + }); + // setData({ ...data, ...res }); + } + }); + }; const handleUpdate = (id: string, d: any) => { const updatedData = { ...data }; @@ -305,17 +334,8 @@ const Settings = ({ data: tempData }: any) => { -

Socials

-
- } - title="Editing Social Links currently does not work" - > - If there are any bugged social links on the build team page right now, message us. - + +

Socials

+
+ {data.socials.map((social: any, i: number) => ( { ]} defaultValue={social.icon} disabled={!allowSocial} - onChange={(e) => handleUpdateSocial(i, 'icon', e)} - /> - handleUpdateSocial(i, 'name', e.target.value)} + onChange={(e) => { + handleUpdateSocial(i, 'icon', e); + handleUpdateSocial(i, 'name', e); + }} /> { disabled={!allowSocial} onChange={(e) => handleUpdateSocial(i, 'url', e.target.value)} /> - + */} ))}
-