use markdown; fix tab selects

This commit is contained in:
Daniel Bulant 2022-05-21 09:48:35 +02:00
parent 625d062e0a
commit 41225805f4

View file

@ -11,6 +11,7 @@
import { slide } from "svelte/transition"; import { slide } from "svelte/transition";
import { Swiper, SwiperSlide } from 'swiper/svelte'; import { Swiper, SwiperSlide } from 'swiper/svelte';
import ArtList from "../../components/artList.svelte"; import ArtList from "../../components/artList.svelte";
import SvelteMarkdown from 'svelte-markdown'
export var scoped; export var scoped;
@ -122,6 +123,7 @@
var format = "cbz"; var format = "cbz";
var selected = []; var selected = [];
function select(chapter) { function select(chapter) {
console.log("Selecting", chapter);
if(selected.includes(chapter)) { if(selected.includes(chapter)) {
selected.splice(selected.indexOf(chapter), 1); selected.splice(selected.indexOf(chapter), 1);
} else { } else {
@ -251,11 +253,11 @@
let anilistData; let anilistData;
$: anilistData = anilistInfo(title); $: anilistData = anilistInfo(title);
var selected = "Chapters"; var selectedTab = "Chapters";
const tabs = ["Chapters", "Art", "More information"]; const tabs = ["Chapters", "Art", "More information"];
$: { $: {
if(swiper && tabs.indexOf(selected) !== swiper.realIndex) swiper.slideTo(tabs.indexOf(selected)); if(swiper && tabs.indexOf(selectedTab) !== swiper.realIndex) swiper.slideTo(tabs.indexOf(selectedTab));
} }
let swiper; let swiper;
@ -263,8 +265,8 @@
swiper = e.detail[0]; swiper = e.detail[0];
} }
function swiperUpdate() { function swiperUpdate() {
if(selected !== tabs[swiper.realIndex]) if(selectedTab !== tabs[swiper.realIndex])
selected = tabs[swiper.realIndex]; selectedTab = tabs[swiper.realIndex];
} }
</script> </script>
@ -310,7 +312,7 @@
<a href="/{relationships.find(t => t.related === "colored" && t.type === "manga").id}" class="block">Colored version</a> <a href="/{relationships.find(t => t.related === "colored" && t.type === "manga").id}" class="block">Colored version</a>
{/if} {/if}
{#if manga.description.en} {#if manga.description.en}
<p>{manga.description.en}</p> <p><SvelteMarkdown source={manga.description.en} isInline /></p>
{/if} {/if}
</div> </div>
</div> </div>
@ -333,7 +335,7 @@
<br> <br>
<Tabs list={tabs} bind:selected /> <Tabs list={tabs} bind:selected={selectedTab} />
<Swiper <Swiper
on:init={swiperInit} on:init={swiperInit}