jormungandr-bite/packages/client/src/components/MkTutorialDialog.vue

201 lines
5.6 KiB
Vue
Raw Normal View History

2022-11-09 00:48:03 -07:00
<template>
<XModalWindow
ref="dialog"
:width="800"
2022-11-09 01:43:27 -07:00
:height="600"
:scroll="true"
2022-11-09 00:48:03 -07:00
@close="dialog.close()"
@closed="$emit('closed')"
>
<template #header>{{ i18n.ts.signup }}</template>
<div class="_monolithic_">
<div class="_section">
2022-11-09 01:38:05 -07:00
<div class="tbkwesmv">
2022-11-09 01:43:27 -07:00
<div class="_footer navigation">
<div class="step">
<button class="arrow _button" :disabled="tutorial === 0" @click="tutorial--">
<i class="ph-caret-left-bold ph-lg"></i>
</button>
<span>{{ tutorial + 1 }} / 6</span>
<button class="arrow _button" :disabled="tutorial === 5" @click="tutorial++">
<i class="ph-caret-right-bold ph-lg"></i>
</button>
</div>
<MkButton v-if="tutorial === 5" class="ok" primary @click="close"><i class="ph-check-bold ph-lg"></i> {{ i18n.ts.gotIt }}</MkButton>
<MkButton v-else class="ok" primary @click="tutorial++"><i class="ph-check-bold ph-lg"></i> {{ i18n.ts.next }}</MkButton>
</div>
<h2 class="_title title"><i class="ph-info-bold ph-lg"></i> {{ i18n.ts._tutorial.title }}</h2>
2022-11-09 01:38:05 -07:00
<div v-if="tutorial === 0" class="_content">
2022-11-09 01:43:27 -07:00
<h3>{{ i18n.ts._tutorial.step1_1 }}</h3>
2022-11-09 01:38:05 -07:00
<div>{{ i18n.ts._tutorial.step1_2 }}</div>
</div>
<div v-else-if="tutorial === 1" class="_content">
2022-11-09 01:43:27 -07:00
<h3>{{ i18n.ts._tutorial.step2_1 }}</h3>
2022-11-09 01:38:05 -07:00
<div>{{ i18n.ts._tutorial.step2_2 }}</div>
<XSettings/>
2022-11-09 02:03:03 -07:00
<MkButton class="ok" primary @click="tutorial++"><i class="ph-check-bold ph-lg"></i> {{ i18n.ts.next }}</MkButton>
2022-11-09 01:38:05 -07:00
</div>
<div v-else-if="tutorial === 2" class="_content">
2022-11-09 01:43:27 -07:00
<h3>{{ i18n.ts._tutorial.step3_1 }}</h3>
2022-11-09 01:38:05 -07:00
<div>{{ i18n.ts._tutorial.step3_2 }}</div>
<XFeaturedUsers/>
2022-11-09 02:03:03 -07:00
<MkButton class="ok" primary @click="tutorial++"><i class="ph-check-bold ph-lg"></i> {{ i18n.ts.next }}</MkButton>
2022-11-09 01:38:05 -07:00
</div>
<div v-else-if="tutorial === 3" class="_content">
2022-11-09 01:43:27 -07:00
<h3>{{ i18n.ts._tutorial.step4_1 }}</h3>
<I18n :src="i18n.ts._tutorial.step4_2" tag="div">
2022-11-09 01:38:05 -07:00
<template #introduction>
<MkA class="_link" to="/tags/introduction">#introduction</MkA>
</template>
</I18n>
2022-11-09 01:43:27 -07:00
<br/>
2022-11-09 01:38:05 -07:00
<XPostForm class="post-form _block"/>
</div>
<div v-else-if="tutorial === 4" class="_content">
2022-11-09 01:43:27 -07:00
<h3>{{ i18n.ts._tutorial.step5_1 }}</h3>
2022-11-09 01:38:05 -07:00
<I18n :src="i18n.ts._tutorial.step5_2" tag="div">
<template #timelines>
<span>{{ timelines.length }}</span>
</template>
</I18n>
<I18n :src="i18n.ts._tutorial.step5_3" tag="div">
<template #icon>
<i class="ph-house-bold ph-lg"/>
</template>
</I18n>
<I18n v-if="timelines.includes('local')" :src="i18n.ts._tutorial.step5_4" tag="div">
<template #icon>
<i class="ph-users-bold ph-lg"/>
</template>
</I18n>
<I18n v-if="timelines.includes('recommended')" :src="i18n.ts._tutorial.step5_5" tag="div">
<template #icon>
<i class="ph-thumbs-up-bold ph-lg"/>
</template>
</I18n>
<I18n v-if="timelines.includes('social')" :src="i18n.ts._tutorial.step5_6" tag="div">
<template #icon>
<i class="ph-handshake-bold ph-lg"/>
</template>
</I18n>
<I18n v-if="timelines.includes('global')" :src="i18n.ts._tutorial.step5_7" tag="div">
<template #icon>
<i class="ph-planet-bold ph-lg"/>
</template>
</I18n>
</div>
<div v-else-if="tutorial === 5" class="_content">
2022-11-09 01:43:27 -07:00
<h3>{{ i18n.ts._tutorial.step6_1 }}</h3>
2022-11-09 01:38:05 -07:00
<div>{{ i18n.ts._tutorial.step6_2 }}</div>
<div>{{ i18n.ts._tutorial.step6_3 }}</div>
2022-11-09 01:54:12 -07:00
<br/>
<MkSparkle>
2022-11-09 02:00:48 -07:00
<h3>{{ i18n.ts._tutorial.step6_4 }} <Mfm text="$[shake 🚀]"></Mfm></h3>
2022-11-09 01:54:12 -07:00
</MkSparkle>
2022-11-09 01:38:05 -07:00
</div>
2022-11-09 00:55:37 -07:00
</div>
2022-11-09 00:48:03 -07:00
</div>
</div>
</XModalWindow>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
2022-11-09 01:01:43 -07:00
import XSettings from '@/pages/settings/profile.vue';
2022-11-09 00:48:03 -07:00
import XModalWindow from '@/components/MkModalWindow.vue';
import MkButton from '@/components/MkButton.vue';
import XFeaturedUsers from '@/pages/explore.users.vue';
2022-11-09 01:38:05 -07:00
import XPostForm from '@/components/MkPostForm.vue';
2022-11-09 01:54:12 -07:00
import MkSparkle from '@/components/MkSparkle.vue';
2022-11-09 00:48:03 -07:00
import { defaultStore } from '@/store';
import { i18n } from '@/i18n';
2022-11-09 01:38:05 -07:00
import { $i } from '@/account';
import { instance } from '@/instance';
const isLocalTimelineAvailable =
!instance.disableLocalTimeline ||
($i != null && ($i.isModerator || $i.isAdmin));
const isRecommendedTimelineAvailable =
!instance.disableRecommendedTimeline ||
($i != null && ($i.isModerator || $i.isAdmin));
const isGlobalTimelineAvailable =
!instance.disableGlobalTimeline ||
($i != null && ($i.isModerator || $i.isAdmin));
let timelines = ['home'];
if (isLocalTimelineAvailable) {
timelines.push('local');
}
if (isRecommendedTimelineAvailable) {
timelines.push('recommended');
}
if (isLocalTimelineAvailable) {
timelines.push('social');
}
if (isGlobalTimelineAvailable) {
timelines.push('global');
}
2022-11-09 00:48:03 -07:00
const emit = defineEmits<{
(ev: 'done'): void;
(ev: 'closed'): void;
}>();
const dialog = $ref<InstanceType<typeof XModalWindow>>();
const tutorial = computed({
get() { return defaultStore.reactiveState.tutorial.value || 0; },
set(value) { defaultStore.set('tutorial', value); },
});
function close(res) {
tutorial.value = -1;
dialog.close();
}
</script>
<style lang="scss" scoped>
.tbkwesmv {
> ._content {
> small {
opacity: 0.7;
}
}
> .navigation {
display: flex;
flex-direction: row;
align-items: baseline;
> .step {
> .arrow {
padding: 4px;
&:disabled {
opacity: 0.5;
}
&:first-child {
padding-right: 8px;
}
&:last-child {
padding-left: 8px;
}
}
> span {
margin: 0 4px;
}
}
> .ok {
margin-left: auto;
}
}
}
</style>