Skip to content

Commit

Permalink
Fix: prevent thumbnail screenshot if not live
Browse files Browse the repository at this point in the history
  • Loading branch information
gagansuie committed May 23, 2024
1 parent 4c57852 commit 37884b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/lib/components/Channel/Chat/DrawerEditChannel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
import IconChatScreenshot from '$lib/assets/icons/chat/IconChatScreenshot.svelte'
import { captureScreenShot } from '$lib/utils'
export let channel: any, showDrawer: boolean
export let channel: any, showDrawer: boolean, isLive: boolean
let fileuploader: HTMLInputElement,
thumbnailRef: any,
showThumbnail = false,
showAddCategory = false,
maxTag = 3,
maxCategory = 4,
imageSrc: string = ''
imageSrc: string = '',
inputTags: HTMLInputElement
$: maxTagLabel = channel?.tags.length == maxTag ? 'max reached' : 'max ' + maxTag
$: maxCategoryLabel =
channel?.category.length == maxCategory ? 'max reached' : 'max ' + maxCategory
onMount(async () => {
let inputTags = document.getElementById('tags')
inputTags?.setAttribute('maxlength', '20')
if (!$tags.length) {
const suggestedTags = await get(`tags`)
Expand Down Expand Up @@ -56,7 +56,7 @@
const checkVideo = (e: any) => {
e.preventDefault()
showThumbnail = true
if (channel.videoItems.length > 0) {
if (isLive && channel.videoItems.length > 0) {
imageSrc = captureScreenShot(channel)
}
}
Expand Down Expand Up @@ -181,7 +181,7 @@
<Tags
bind:tags={channel.tags}
maxTags={maxTag}
id="tags"
bind:this={inputTags}
placeholder={channel.tags.length > 0 ? '' : 'Tag'} />
<span class="absolute right-0 top-1/2 text-gray-400 pr-3">({maxTagLabel})</span>
{#if channel.tags.length === 0}
Expand Down Expand Up @@ -217,7 +217,7 @@
<div class="flex flex-row gap-2 mt-auto p-3">
<button type="button" class="btn btn-neutral grow" on:click={() => toggleDrawer()}
>Cancel</button>
<button type="submit" class="btn btn-primary grow">Edit</button>
<button type="submit" class="btn btn-primary grow">Apply</button>
</div>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export const getHref = async ({
'x-api-key': xApiKey
}
})
const { loginUrl } = await response.json()
const { loginUrl }: any = await response.json()
window.location.replace(loginUrl)
}

Expand Down
2 changes: 1 addition & 1 deletion src/routes/channel/[channelId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
bind:viewers />

{#if showEditChannelDrawer}
<DrawerEditChannel bind:channel bind:showDrawer={showEditChannelDrawer} />
<DrawerEditChannel bind:channel bind:showDrawer={showEditChannelDrawer} bind:isLive />
{/if}
</div>
{#if !$is_chat_drawer_destroy}
Expand Down

0 comments on commit 37884b3

Please sign in to comment.