Skip to content

Commit

Permalink
Merge pull request #7 from Sygnator/dev
Browse files Browse the repository at this point in the history
Bug fix and sidebar code refactor
  • Loading branch information
Sygnator authored Apr 18, 2024
2 parents e2e43bc + 7a4cfd7 commit 9c15174
Showing 1 changed file with 23 additions and 45 deletions.
68 changes: 23 additions & 45 deletions src/lib/components/SideBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
let spanClass = 'flex-1 ms-3 whitespace-nowrap';
let openModal = false;
let imageUrl = '';
let cardsAmount = 12;
let shadowsOpacity = 30;
let shadowsOpacity = 70;
function changeKarma() {
if ($profileConfig.karma == KarmaState.Angel) {
Expand Down Expand Up @@ -120,13 +122,13 @@
>Przeźroczystość paska</Toggle
>
<Label>
Cienie: {`${shadowsOpacity < 10 ? '  ' : shadowsOpacity < 100 ? '' : ''}${shadowsOpacity + '%'}`}
Przeźroczystość cieni: {`${shadowsOpacity < 10 ? '  ' : shadowsOpacity < 100 ? '' : ''}${shadowsOpacity + '%'}`}
<Range
min="0"
max="100"
step="1"
bind:value={shadowsOpacity}
on:change={() => profileConfig.setShadowsOpacity(shadowsOpacity / 100)}
on:change={() => profileConfig.setShadowsOpacity((100 - shadowsOpacity) / 100)}
></Range>
</Label>
{/if}
Expand Down Expand Up @@ -169,6 +171,7 @@
size="small"
style="filled"
type="text"
bind:value={imageUrl}
on:change={handleChange(profileConfig.setImage)}
>
Obrazek
Expand All @@ -182,46 +185,17 @@
{/if}
</SidebarGroup>

{#if $profileConfig.profileType == ProfileTypeEnum.Stats}
<SidebarGroup border>
<SidebarGroup border>
{#if $profileConfig.profileType == ProfileTypeEnum.Stats || $profileConfig.profileType == ProfileTypeEnum.StatsOnImg || $profileConfig.profileType == ProfileTypeEnum.StatsWithImg}
<Toggle checked={$profileConfig.animeStats} on:change={profileConfig.switchAnimeStats}>
Pokaż Statystyki Anime
</Toggle>
<Toggle checked={$profileConfig.mangaStats} on:change={profileConfig.switchMangaStats}>
Pokaż Statystyki Mangi
</Toggle>
<Toggle checked={$profileConfig.cardsStats} on:change={profileConfig.switchCardsStats}>
Pokaż Karciankę
</Toggle>
<Toggle checked={$profileConfig.flip} on:change={profileConfig.switchFlip}>
Odwróć układ
</Toggle>
<SidebarItem label="Karma" {spanClass} on:click={changeKarma}>
<svelte:fragment slot="icon">
<img src={`/profile_assets/${$profileConfig.karma}.png`} alt="karma" />
</svelte:fragment>
<svelte:fragment slot="subtext">
<span
class="ms-3 inline-flex items-center justify-center rounded-full bg-gray-200 px-2 text-sm font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-300"
>
{#if $profileConfig.karma == KarmaState.Angel}
Dodatnia
{:else if $profileConfig.karma == KarmaState.Demon}
Ujemna
{:else}
Neutralna
{/if}
</span>
</svelte:fragment>
</SidebarItem>
</SidebarGroup>
{/if}
{/if}

{#if $profileConfig.profileType == ProfileTypeEnum.MiniGallery}
<SidebarGroup border>
<Toggle checked={$profileConfig.cardsStats} on:change={profileConfig.switchCardsStats}>
Pokaż Karciankę
</Toggle>
{#if $profileConfig.profileType == ProfileTypeEnum.MiniGallery || $profileConfig.profileType == ProfileTypeEnum.MiniGalleryOnImg}
<Toggle checked={$profileConfig.miniGallery} on:change={profileConfig.switchMiniGallery}>
Pokaż mini galerię
</Toggle>
Expand All @@ -234,9 +208,15 @@
Ilość kart
</Toggle>
<Tooltip content="Ilość kart w minigalerii - 6 lub 2" placement="left" type="auto" />
<Toggle checked={$profileConfig.flip} on:change={profileConfig.switchFlip}
>Odwróć układ</Toggle
>
{/if}

{#if $profileConfig.profileType != ProfileTypeEnum.Img && $profileConfig.profileType != ProfileTypeEnum.Cards && $profileConfig.profileType != ProfileTypeEnum.CardsOnImg}
<Toggle checked={$profileConfig.cardsStats} on:change={profileConfig.switchCardsStats}>
Pokaż Karciankę
</Toggle>
<Toggle checked={$profileConfig.flip} on:change={profileConfig.switchFlip}>
Odwróć układ
</Toggle>
<SidebarItem label="Karma" {spanClass} on:click={changeKarma}>
<svelte:fragment slot="icon">
<img src={`/profile_assets/${$profileConfig.karma}.png`} alt="karma" />
Expand All @@ -255,11 +235,9 @@
</span>
</svelte:fragment>
</SidebarItem>
</SidebarGroup>
{/if}
{/if}

{#if $profileConfig.profileType == ProfileTypeEnum.Cards}
<SidebarGroup border>
{#if $profileConfig.profileType == ProfileTypeEnum.Cards || $profileConfig.profileType == ProfileTypeEnum.CardsOnImg}
<Label>
Ilość kart: {cardsAmount < 10 ? '0' + cardsAmount : cardsAmount}
<Range
Expand All @@ -270,8 +248,8 @@
on:change={() => profileConfig.setCardsAmount(cardsAmount)}
></Range>
</Label>
</SidebarGroup>
{/if}
{/if}
</SidebarGroup>
</SidebarWrapper>
</Sidebar>
<ChooseCustomBorder bind:openModal />

0 comments on commit 9c15174

Please sign in to comment.