From 2ad9a9bd3e0cb93db1dd970b2fd4d957bef12d2c Mon Sep 17 00:00:00 2001 From: Kawsar Ahmed Date: Sun, 5 Feb 2023 00:53:54 -0500 Subject: [PATCH 01/11] fix form and responsive --- .../components/Browse/CreateChannelDrawer.svelte | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/components/Browse/CreateChannelDrawer.svelte b/src/lib/components/Browse/CreateChannelDrawer.svelte index 599f1cd4..bf78f718 100644 --- a/src/lib/components/Browse/CreateChannelDrawer.svelte +++ b/src/lib/components/Browse/CreateChannelDrawer.svelte @@ -78,11 +78,11 @@ bind:categoryIcons bind:categories={newChannel.category} /> {:else} -
-

- Create a new channel -

-
addChannel()}> + addChannel()}> +
+

+ Create a new channel +

When you create a channel, you may allow viewer's to observe your desktop as you host @@ -176,8 +176,8 @@ >Cancel

- -
+
+ {/if} From d6bf860e174d8d70777ea2b1dedbdb25ae1ee7d5 Mon Sep 17 00:00:00 2001 From: Kawsar Ahmed Date: Sun, 5 Feb 2023 01:20:10 -0500 Subject: [PATCH 02/11] fix loading sections --- src/lib/components/Browse/Sections/ChannelSection.svelte | 6 ++++-- src/lib/components/Browse/Sections/UserSection.svelte | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/components/Browse/Sections/ChannelSection.svelte b/src/lib/components/Browse/Sections/ChannelSection.svelte index a785a01e..dc3d8252 100644 --- a/src/lib/components/Browse/Sections/ChannelSection.svelte +++ b/src/lib/components/Browse/Sections/ChannelSection.svelte @@ -30,8 +30,10 @@ } -{#if !channels.error} -
+{#if channels && !channels.error} +
{#if channels && channels.length}
{title} diff --git a/src/lib/components/Browse/Sections/UserSection.svelte b/src/lib/components/Browse/Sections/UserSection.svelte index 31d961ab..0dcdd55d 100644 --- a/src/lib/components/Browse/Sections/UserSection.svelte +++ b/src/lib/components/Browse/Sections/UserSection.svelte @@ -30,8 +30,8 @@ } -{#if !users.error} -
+{#if users && !users.error} +
{#if users && users.length}
{title} From 8467b7e47b2dca3545052451aff5c89c3a01636a Mon Sep 17 00:00:00 2001 From: Kawsar Ahmed Date: Sun, 5 Feb 2023 01:27:05 -0500 Subject: [PATCH 03/11] fix carousela nd table loading --- .../Browse/Sections/CarouselSection.svelte | 4 +- .../Browse/Sections/LoadingTableItem.svelte | 54 +++++++++---------- .../Browse/Sections/TableSection.svelte | 12 +++-- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/lib/components/Browse/Sections/CarouselSection.svelte b/src/lib/components/Browse/Sections/CarouselSection.svelte index 2caf1883..9ddcb2ad 100644 --- a/src/lib/components/Browse/Sections/CarouselSection.svelte +++ b/src/lib/components/Browse/Sections/CarouselSection.svelte @@ -9,7 +9,7 @@ let ref: any, showback = false - $: channels = channels + $: channels = channels.splice(0, 5) const prev = () => { if (ref) { @@ -46,7 +46,6 @@ bind:this={ref} class="carousel-content relative w-full flex gap-6 snap-x snap-mandatory overflow-x-auto pt-14 flex-grow"> {#if channels && channels.length} -
{#each channels as channel}
@@ -67,7 +66,6 @@
{/each} -
{:else}
{#each Array(6) as _, index (index)} diff --git a/src/lib/components/Browse/Sections/LoadingTableItem.svelte b/src/lib/components/Browse/Sections/LoadingTableItem.svelte index 0ef17cd3..bd74e28a 100644 --- a/src/lib/components/Browse/Sections/LoadingTableItem.svelte +++ b/src/lib/components/Browse/Sections/LoadingTableItem.svelte @@ -1,27 +1,27 @@ - - -
- Loading... -
- - -
- Loading... -
- - -
- Loading... -
- - -
- Loading... -
- - -
- Loading... -
- - + + +
+ Loading... +
+ + +
+ Loading... +
+ + +
+ Loading... +
+ + +
+ Loading... +
+ + +
+ Loading... +
+ + diff --git a/src/lib/components/Browse/Sections/TableSection.svelte b/src/lib/components/Browse/Sections/TableSection.svelte index e1e28407..e9fadec3 100644 --- a/src/lib/components/Browse/Sections/TableSection.svelte +++ b/src/lib/components/Browse/Sections/TableSection.svelte @@ -76,12 +76,14 @@ {/each} {:else} -
- {#each Array(6) as _, index (index)} + + {#each Array(5) as _, index (index)} + - {/each} - Loading... -
+ + {/each} + Loading... + {/if} From 0dccc1b29440787d01104842feb8ca3672f600be Mon Sep 17 00:00:00 2001 From: Kawsar Ahmed Date: Mon, 6 Feb 2023 05:42:51 -0500 Subject: [PATCH 04/11] swiper installed --- package.json | 1 + .../Browse/Sections/CarouselSection.svelte | 77 +++++++++++++------ src/routes/browse/+page.server.ts | 39 ++++++++-- src/routes/browse/+page.svelte | 6 +- 4 files changed, 91 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 88ae17d7..4d7b36ed 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "svelte-preprocess": "^5.0.1", "svelte-tags-input": "^4.0.0", "svgo": "^3.0.2", + "swiper": "^9.0.2", "tailwind-clip-path": "^1.0.0", "tailwind-scrollbar": "^2.1.0", "tailwindcss": "^3.2.4", diff --git a/src/lib/components/Browse/Sections/CarouselSection.svelte b/src/lib/components/Browse/Sections/CarouselSection.svelte index 9ddcb2ad..8c1fe68f 100644 --- a/src/lib/components/Browse/Sections/CarouselSection.svelte +++ b/src/lib/components/Browse/Sections/CarouselSection.svelte @@ -3,15 +3,24 @@ import IconDrawerChevron from '$lib/assets/icons/drawer/IconDrawerChevron.svelte' import { goto } from '$app/navigation' import LoadingCarouselItem from '$lib/components/Browse/Sections/LoadingCarouselItem.svelte' + import { onMount } from 'svelte' + import Swiper, { Navigation } from 'swiper' + + import 'swiper/css' export let channels: any = [] let ref: any, showback = false - $: channels = channels.splice(0, 5) + $: channels = channels.splice(0, 6) const prev = () => { + if (swiper) { + swiper.slidePrev() + } + return + if (ref) { showback = ref.scrollLeft > 500 ref.scrollTo({ @@ -20,16 +29,37 @@ }) } } - + $: console.log(channels) const next = () => { + if (swiper) { + swiper.slideNext() + } + return + if (ref) { showback = true ref.scrollTo({ left: ref.scrollLeft + 500, behavior: 'smooth' }) + channels.push(channels[0]) + channels.shift() + channels = channels } } + let swiper: Swiper + + onMount(() => { + swiper = new Swiper('.mySwiper', { + slidesPerView: 3, + loop: true, + modules: [Navigation], + navigation: { + nextEl: '.btn-next', + prevEl: '.btn-prev' + } + }) + }) {#if !channels.error} @@ -37,35 +67,36 @@
+ class="bg-base-200 rounded-full p-3 btn-prev absolute top-2/4 left-1 z-10 cursor-pointer" + on:click={() => prev()}>