From 72a8350eb604a82c109009c53d6e354cd4825da8 Mon Sep 17 00:00:00 2001 From: Gagan Suie Date: Tue, 27 Jun 2023 12:06:45 -0500 Subject: [PATCH 1/4] Fix: WIP subscriptions --- src/lib/components/Profile/TabSection.svelte | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/components/Profile/TabSection.svelte b/src/lib/components/Profile/TabSection.svelte index a1b2cc52..7fe0e55d 100644 --- a/src/lib/components/Profile/TabSection.svelte +++ b/src/lib/components/Profile/TabSection.svelte @@ -1,15 +1,15 @@ @@ -24,15 +24,15 @@ {/each}
- -
+
+
- +
From de200f6bde0e23cca0cda4dfa51bd9e2a7846715 Mon Sep 17 00:00:00 2001 From: Gagan Suie Date: Tue, 27 Jun 2023 12:46:56 -0500 Subject: [PATCH 2/4] Fix: trending gifs endpoint not working --- .../components/Channel/Chat/GifPicker.svelte | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/lib/components/Channel/Chat/GifPicker.svelte b/src/lib/components/Channel/Chat/GifPicker.svelte index 715bda38..214da21d 100644 --- a/src/lib/components/Channel/Chat/GifPicker.svelte +++ b/src/lib/components/Channel/Chat/GifPicker.svelte @@ -8,22 +8,26 @@ export let onSelect: any, isChannelSocketConnected: any + $: if (isChannelSocketConnected) { + getTrending() + } + let gifs: { downsized_large: string; original: string; title: string }[] = [] let searched: { downsized_large: string; original: string; title: string }[] = [] let query: string = '' let loading = false - onMount(async () => { + onMount(async () => {}) + + const getTrending = async () => { loading = true - if (isChannelSocketConnected) { - const resp = await get('giphy/trending', { - userId: $page.data.user?.userId, - token: $page.data.user?.token - }) - if (resp && Array.isArray(resp)) gifs = resp - } + const resp = await get('giphy/trending', { + userId: $page.data.user?.userId, + token: $page.data.user?.token + }) + if (resp && Array.isArray(resp)) gifs = resp loading = false - }) + } const onSearch = async (evt: any) => { query = evt.target.value @@ -65,7 +69,7 @@ {:else if list.length} -
+
{#each list as gif}
- gif + gif
{/each}
From c453695c30992b576dddd044d65ebb4844c9ae58 Mon Sep 17 00:00:00 2001 From: Gagan Suie Date: Tue, 27 Jun 2023 13:32:00 -0500 Subject: [PATCH 3/4] Fix: added feature flags for stats and subscribes --- src/lib/components/Profile/TabSection.svelte | 28 +++++++++++++------ src/lib/stores/remoteConfigStore.ts | 2 ++ src/routes/+layout.svelte | 6 +++- src/routes/browse/+page.svelte | 20 ------------- src/routes/profile/[username]/+page.server.ts | 8 ++---- 5 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/lib/components/Profile/TabSection.svelte b/src/lib/components/Profile/TabSection.svelte index 7fe0e55d..e405fbc3 100644 --- a/src/lib/components/Profile/TabSection.svelte +++ b/src/lib/components/Profile/TabSection.svelte @@ -2,15 +2,21 @@ import ListSubscribe from '$lib/components/Profile/ListSubscribe.svelte' import SectionTable from '$lib/components/Browse/Sections/SectionTable.svelte' import Stats from '$lib/components/Profile/Elements/Stats.svelte' + import { + is_feature_stats_enabled, + is_feature_subscribes_enabled + } from '$lib/stores/remoteConfigStore' export let profileId: string = '', channels: Promise, subscribers: Promise, interests: Promise - let tabs = ['Stats', 'Channels', 'Subscribers'] - // let tabs = ['Channels'] + let tabs = ['Channels'] let activeTab = 0 + + $: if ($is_feature_subscribes_enabled) tabs.push('Subscribers') + $: if ($is_feature_stats_enabled) tabs.push('Stats')
@@ -24,15 +30,19 @@ {/each}
-
- -
-
+ {#if $is_feature_stats_enabled} +
+ +
+ {/if} +
-
- -
+ {#if $is_feature_subscribes_enabled} +
+ +
+ {/if}
diff --git a/src/lib/stores/remoteConfigStore.ts b/src/lib/stores/remoteConfigStore.ts index 27f196d8..08136620 100644 --- a/src/lib/stores/remoteConfigStore.ts +++ b/src/lib/stores/remoteConfigStore.ts @@ -2,3 +2,5 @@ import { writable, type Writable } from 'svelte/store' export const is_feature_video_responses_enabled: Writable = writable(false) export const is_feature_premium_page_enabled: Writable = writable(false) +export const is_feature_subscribes_enabled: Writable = writable(false) +export const is_feature_stats_enabled: Writable = writable(false) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index d5948f8d..4fb4fd1f 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -22,7 +22,9 @@ import { current_theme } from '$lib/stores/helperStore' import { is_feature_premium_page_enabled, - is_feature_video_responses_enabled + is_feature_subscribes_enabled, + is_feature_video_responses_enabled, + is_feature_stats_enabled } from '$lib/stores/remoteConfigStore' import { env } from '$env/dynamic/public' import { user_role } from '$lib/stores/authStore' @@ -47,6 +49,8 @@ $current_theme = localStorage.getItem('theme') || 'dark' $is_feature_premium_page_enabled = env.PUBLIC_FEATURE_PREMIUM_PAGE === 'true' $is_feature_video_responses_enabled = env.PUBLIC_FEATURE_VIDEO_RESPONSES === 'true' + $is_feature_subscribes_enabled = env.PUBLIC_FEATURE_SUBSCRIBES === 'true' + $is_feature_stats_enabled = env.PUBLIC_FEATURE_STATS === 'true' await handleWebsocket() if (!$category_list.length) { $category_list = imageUrlsJson diff --git a/src/routes/browse/+page.svelte b/src/routes/browse/+page.svelte index 08f2fd8a..b1d8125c 100644 --- a/src/routes/browse/+page.svelte +++ b/src/routes/browse/+page.svelte @@ -15,26 +15,6 @@ onMount(async () => { $video_items = [] - - // const newUsers = await get('/api/users') - // newUsers.forEach(async (user: any) => { - // if (user.avatar.includes('ui-avatars')) { - // const newChannel = { - // title: '', - // description: '', - // category: '', - // tags: '', - // createdByDisplayName: user.displayName, - // createdByUsername: user.username, - // avatar: user.avatar, - // channelType: 'channel' - // } - // await post('channel', newChannel, { - // userId: user._id, - // token: $page.data.user.token - // }) - // } - // }) }) diff --git a/src/routes/profile/[username]/+page.server.ts b/src/routes/profile/[username]/+page.server.ts index e2274430..3b189b98 100644 --- a/src/routes/profile/[username]/+page.server.ts +++ b/src/routes/profile/[username]/+page.server.ts @@ -36,12 +36,9 @@ export const actions = { addPropertyIfDefined(data, 'category', newUser) addPropertyIfDefined(data, 'bio', newUser) + const avatar = data.get('avatar') as File - const avatar = data.get('avatar') as File - - const banner = data.get('banner') as File - - + const banner = data.get('banner') as File if (data.get('avatar') !== null && avatar.size > 0) { const urlLocation = await putImage( @@ -108,7 +105,6 @@ export const actions = { await new Promise((resolve) => setTimeout(resolve, 1000)) }, search: async ({ request, locals }: { request: any; locals: any }) => { - console.log('got here----324324234') const data = await request.formData() const search = data.get('query') await new Promise((resolve) => setTimeout(resolve, 1000)) From c454dc93772ece5c708d66d849371d5ac9ee387f Mon Sep 17 00:00:00 2001 From: Gagan Suie Date: Tue, 27 Jun 2023 13:32:49 -0500 Subject: [PATCH 4/4] Chore: updated version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 874f1b0f..50c0f97e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mage-website", - "version": "0.0.7", + "version": "0.0.8", "license": "GPL-3.0", "private": true, "type": "module",