From 83cf4565a49b72ba69048c694c47be7cbb05f5cc Mon Sep 17 00:00:00 2001 From: sitaradev Date: Wed, 13 Sep 2023 19:18:13 +0530 Subject: [PATCH 01/13] multi urls on profile update --- .../Profile/DrawerEditProfile.svelte | 41 +++++++++++++++++-- .../Profile/Elements/UserDetails.svelte | 17 ++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/lib/components/Profile/DrawerEditProfile.svelte b/src/lib/components/Profile/DrawerEditProfile.svelte index d95a4dd9..8ccba26f 100644 --- a/src/lib/components/Profile/DrawerEditProfile.svelte +++ b/src/lib/components/Profile/DrawerEditProfile.svelte @@ -2,11 +2,23 @@ import { enhance } from '$app/forms' import { page } from '$app/stores' import DrawerAddCategory from '$lib/components/Browse/DrawerAddCategory.svelte' + import IconLink from '$lib/assets/icons/IconLink.svelte' + import IconSocialTwitter from '$lib/assets/icons/social/IconSocialTwitter.svelte' + import IconSocialDiscord from '$lib/assets/icons/social/IconSocialDiscord.svg' + import IconSocialGitHub from '$lib/assets/icons/social/IconSocialGitHub.svelte' import { category_list } from '$lib/stores/channelStore' import { createEffect } from '$lib/utils' export let showDrawer: boolean export let profile: any + // export let profile: { website: string[]; [key: string]: any } = { website: [''] } + + let inputFields = [profile.urls] + + function addInputField() { + inputFields = [...inputFields, ''] + // profile.website = [...profile.website, ''] + } let params = $page.params @@ -54,6 +66,8 @@ } } }, [$page.params]) + + $: console.log('profile: ', profile)
@@ -71,6 +85,7 @@ {:else}
{ submitBtn.disabled = true }}> -
+

Update Profile

@@ -109,13 +124,33 @@ username.setCustomValidity('') }} /> - + placeholder="Your website URL" /> --> + + {#each inputFields as url, index (url)} +
+ +
+ +
+
+ {/each} + +
+ +
diff --git a/src/lib/components/Profile/Elements/UserDetails.svelte b/src/lib/components/Profile/Elements/UserDetails.svelte index e339123d..d2f5b7e4 100644 --- a/src/lib/components/Profile/Elements/UserDetails.svelte +++ b/src/lib/components/Profile/Elements/UserDetails.svelte @@ -1,6 +1,9 @@
@@ -124,91 +162,112 @@ username.setCustomValidity('') }} /> - - - {#each inputFields as url, index (url)} -
- -
- -
-
- {/each} - -
- -
+ placeholder="Your website URL" />
- -
-
- - - -
+ {#each inputFields as url, index (index)} +
+
+ +
+ +
+
+ {#if index === inputFields.length - 1} + + {:else} + + {/if} +
+ {/each} -
- (showAddCategory = true)} - type="text" - name="category-search" - placeholder={profile?.category?.length ? '' : 'Category'} - class="input input-primary input-bordered mt-5 w-full" /> - ({maxCategoryLabel}) - - {#if profile?.category?.length} - {#each profile?.category as icon} - - {/each} - {/if} - -
+
+ + + +
-