Skip to content

Commit

Permalink
Merge pull request #571 from gagan-suie/dev
Browse files Browse the repository at this point in the history
Fix: added feature flags for stats and subscribes
  • Loading branch information
gagansuie authored Jun 27, 2023
2 parents 0a69a81 + c453695 commit 0458bb5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 36 deletions.
28 changes: 19 additions & 9 deletions src/lib/components/Profile/TabSection.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>,
subscribers: Promise<any>,
interests: Promise<any>
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')
</script>

<div class="mt-10 py-10 border-t border-blueGray-200 text-center">
Expand All @@ -24,15 +30,19 @@
{/each}
</div>
<div class="w-full px-4">
<div class="grid h-full" class:hidden={activeTab != 0}>
<Stats />
</div>
<div class="flex-auto h-full text-left" class:hidden={activeTab != 1}>
{#if $is_feature_stats_enabled}
<div class="grid h-full" class:hidden={activeTab != tabs.indexOf('Stats')}>
<Stats />
</div>
{/if}
<div class="flex-auto h-full text-left" class:hidden={activeTab != tabs.indexOf('Channels')}>
<SectionTable {channels} {profileId} />
</div>
<div class="flex-auto h-full" class:hidden={activeTab != 2}>
<ListSubscribe {subscribers} {interests} />
</div>
{#if $is_feature_subscribes_enabled}
<div class="flex-auto h-full" class:hidden={activeTab != tabs.indexOf('Subscribers')}>
<ListSubscribe {subscribers} {interests} />
</div>
{/if}
</div>
</div>
</div>
2 changes: 2 additions & 0 deletions src/lib/stores/remoteConfigStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ import { writable, type Writable } from 'svelte/store'

export const is_feature_video_responses_enabled: Writable<boolean> = writable(false)
export const is_feature_premium_page_enabled: Writable<boolean> = writable(false)
export const is_feature_subscribes_enabled: Writable<boolean> = writable(false)
export const is_feature_stats_enabled: Writable<boolean> = writable(false)
6 changes: 5 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
20 changes: 0 additions & 20 deletions src/routes/browse/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
// })
// }
// })
})
</script>

Expand Down
8 changes: 2 additions & 6 deletions src/routes/profile/[username]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -108,7 +105,6 @@ export const actions = {
await new Promise<any>((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<any>((resolve) => setTimeout(resolve, 1000))
Expand Down

0 comments on commit 0458bb5

Please sign in to comment.