feat: move modal out of views and into global app context
This commit is contained in:
parent
d0f9434700
commit
cc664a764d
4 changed files with 30 additions and 52 deletions
34
src/App.vue
34
src/App.vue
|
@ -2,6 +2,9 @@
|
||||||
import { ref, provide } from "vue";
|
import { ref, provide } from "vue";
|
||||||
import { RouterView } from "vue-router";
|
import { RouterView } from "vue-router";
|
||||||
import { isWarnKey, modalResultKey, nsfwKey, showModalKey } from "@/keys";
|
import { isWarnKey, modalResultKey, nsfwKey, showModalKey } from "@/keys";
|
||||||
|
import RefModal from "@/components/RefModal.vue";
|
||||||
|
import ButtonGroup from "@/components/ButtonGroup.vue";
|
||||||
|
import Button from "@/components/RefButton.vue";
|
||||||
import SiteHeader from "@/components/SiteHeader.vue";
|
import SiteHeader from "@/components/SiteHeader.vue";
|
||||||
import SiteFooter from "@/components/SiteFooter.vue";
|
import SiteFooter from "@/components/SiteFooter.vue";
|
||||||
import SiteNavigation from "@/components/SiteNavigation.vue";
|
import SiteNavigation from "@/components/SiteNavigation.vue";
|
||||||
|
@ -13,10 +16,11 @@ const isNsfw = ref(false);
|
||||||
const isConfirmedHorny = ref(false);
|
const isConfirmedHorny = ref(false);
|
||||||
const isWarn = ref(false);
|
const isWarn = ref(false);
|
||||||
|
|
||||||
|
const nsfwmodal = ref<InstanceType<typeof RefModal>>();
|
||||||
|
|
||||||
const showModal = (): void => {
|
const showModal = (): void => {
|
||||||
if (!isConfirmedHorny.value) {
|
if (!isConfirmedHorny.value) {
|
||||||
isWarn.value = true;
|
nsfwmodal.value?.showModal();
|
||||||
document.body.classList.add("scroll-lock");
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
isNsfw.value = false;
|
isNsfw.value = false;
|
||||||
|
@ -29,8 +33,7 @@ const showModal = (): void => {
|
||||||
const modalResult = (value: boolean): void => {
|
const modalResult = (value: boolean): void => {
|
||||||
isNsfw.value = value;
|
isNsfw.value = value;
|
||||||
isConfirmedHorny.value = value;
|
isConfirmedHorny.value = value;
|
||||||
isWarn.value = false;
|
nsfwmodal.value?.close();
|
||||||
document.body.classList.remove("scroll-lock");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
provide(isWarnKey, isWarn);
|
provide(isWarnKey, isWarn);
|
||||||
|
@ -40,6 +43,29 @@ provide(showModalKey, showModal);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<RefModal id="nsfw-warning" ref="nsfwmodal">
|
||||||
|
<template #heading>
|
||||||
|
⚠️⚠️⚠️<br />
|
||||||
|
Whoa, Nelly!
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #message>
|
||||||
|
By enabling NSFW mode you confirm that you are of legal age to view adult
|
||||||
|
content.
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #buttons>
|
||||||
|
<ButtonGroup col>
|
||||||
|
<Button positive @click.prevent="modalResult(true)">
|
||||||
|
Yes, show me the goods 👀
|
||||||
|
</Button>
|
||||||
|
<Button negative @click.prevent="modalResult(false)">
|
||||||
|
NO, STAHP 😱
|
||||||
|
</Button>
|
||||||
|
</ButtonGroup>
|
||||||
|
</template>
|
||||||
|
</RefModal>
|
||||||
|
|
||||||
<SiteHeader>
|
<SiteHeader>
|
||||||
<!-- max 500px -->
|
<!-- max 500px -->
|
||||||
<picture>
|
<picture>
|
||||||
|
|
|
@ -5,7 +5,6 @@ import type { ColorDict } from "@/interfaces";
|
||||||
import { tailLength, wingspan, penis, colors } from "@/sebin";
|
import { tailLength, wingspan, penis, colors } from "@/sebin";
|
||||||
import { toImperial, toFahrenheit } from "@/helpers";
|
import { toImperial, toFahrenheit } from "@/helpers";
|
||||||
import RefToggle from "@/components/RefToggle.vue";
|
import RefToggle from "@/components/RefToggle.vue";
|
||||||
import RefModal from "@/components/RefModal.vue";
|
|
||||||
import RefGallery from "@/components/RefGallery.vue";
|
import RefGallery from "@/components/RefGallery.vue";
|
||||||
import RefFigure from "@/components/RefFigure.vue";
|
import RefFigure from "@/components/RefFigure.vue";
|
||||||
import ColorTable from "@/components/ColorTable.vue";
|
import ColorTable from "@/components/ColorTable.vue";
|
||||||
|
@ -39,21 +38,6 @@ const showModal = inject<Function>(showModalKey, Function);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RefModal v-show="isWarn">
|
|
||||||
<template #heading>
|
|
||||||
⚠️⚠️⚠️<br />
|
|
||||||
Whoa, Nelly!
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #message>
|
|
||||||
By enabling NSFW mode you confirm that you are of legal age to view adult
|
|
||||||
content.
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #yes>Yes, show me the goods 👀</template>
|
|
||||||
<template #no>NO, STAHP 😱</template>
|
|
||||||
</RefModal>
|
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h1>{{ $route.name }}</h1>
|
<h1>{{ $route.name }}</h1>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -21,7 +21,6 @@ import type { Kink } from "@/interfaces";
|
||||||
import DataTable from "@/components/DataTable.vue";
|
import DataTable from "@/components/DataTable.vue";
|
||||||
import QuickFacts from "@/components/QuickFacts.vue";
|
import QuickFacts from "@/components/QuickFacts.vue";
|
||||||
import RefToggle from "@/components/RefToggle.vue";
|
import RefToggle from "@/components/RefToggle.vue";
|
||||||
import RefModal from "@/components/RefModal.vue";
|
|
||||||
|
|
||||||
const generalHeadings = ["Key", "Value"];
|
const generalHeadings = ["Key", "Value"];
|
||||||
const generalData = [
|
const generalData = [
|
||||||
|
@ -57,21 +56,6 @@ const showModal = inject<Function>(showModalKey, Function);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RefModal v-show="isWarn">
|
|
||||||
<template #heading>
|
|
||||||
⚠️⚠️⚠️<br />
|
|
||||||
Whoa, Nelly!
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #message>
|
|
||||||
By enabling NSFW mode you confirm that you are of legal age to view adult
|
|
||||||
content.
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #yes>Yes, show me the goods 👀</template>
|
|
||||||
<template #no>NO, STAHP 😱</template>
|
|
||||||
</RefModal>
|
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h1>{{ $route.name }}</h1>
|
<h1>{{ $route.name }}</h1>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import { inject } from "vue";
|
import { inject } from "vue";
|
||||||
import { isWarnKey, nsfwKey, showModalKey } from "@/keys";
|
import { isWarnKey, nsfwKey, showModalKey } from "@/keys";
|
||||||
import RefToggle from "@/components/RefToggle.vue";
|
import RefToggle from "@/components/RefToggle.vue";
|
||||||
import RefModal from "@/components/RefModal.vue";
|
|
||||||
import WelcomeHeader from "@/components/WelcomeHeader.vue";
|
import WelcomeHeader from "@/components/WelcomeHeader.vue";
|
||||||
import ButtonGroup from "@/components/ButtonGroup.vue";
|
import ButtonGroup from "@/components/ButtonGroup.vue";
|
||||||
import Button from "@/components/RefButton.vue";
|
import Button from "@/components/RefButton.vue";
|
||||||
|
@ -13,21 +12,6 @@ const showModal = inject<Function>(showModalKey, Function);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RefModal v-show="isWarn">
|
|
||||||
<template #heading>
|
|
||||||
⚠️⚠️⚠️<br />
|
|
||||||
Whoa, Nelly!
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #message>
|
|
||||||
By enabling NSFW mode you confirm that you are of legal age to view adult
|
|
||||||
content.
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #yes>Yes, show me the goods 👀</template>
|
|
||||||
<template #no>NO, STAHP 😱</template>
|
|
||||||
</RefModal>
|
|
||||||
|
|
||||||
<WelcomeHeader>
|
<WelcomeHeader>
|
||||||
<template #main>Sebin Nyshkim</template>
|
<template #main>Sebin Nyshkim</template>
|
||||||
<template #sub>Character Reference Page</template>
|
<template #sub>Character Reference Page</template>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue