Add timeline hints
This commit is contained in:
parent
020b212b10
commit
7527351620
@ -1,19 +1,34 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="info" :class="{ warn, card }">
|
<div v-if="visible" class="info" :class="{ warn, card }">
|
||||||
<i v-if="warn" class="ph-warning ph-bold ph-lg"></i>
|
<i v-if="warn" class="ph-warning ph-bold ph-lg"></i>
|
||||||
<i v-else class="ph-bold ph-lg" :class="icon ? `ph-${icon}` : 'ph-info'"></i>
|
<i v-else class="ph-bold ph-lg" :class="icon ? `ph-${icon}` : 'ph-info'"></i>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
<button class="_button close" @click.stop="close">
|
||||||
|
<i class="ph-x ph-bold ph-lg"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {} from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
const visible = ref(true);
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
icon?: string;
|
icon?: string;
|
||||||
warn?: boolean;
|
warn?: boolean;
|
||||||
card?: boolean;
|
card?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(ev: "close"): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
visible.value = false;
|
||||||
|
emit("close");
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -54,5 +69,9 @@ defineProps<{
|
|||||||
> i {
|
> i {
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
> .close {
|
||||||
|
margin-left: auto;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<MkInfo v-if="tlHint && !tlHintClosed" class="_gap" @close="closeHint">
|
||||||
|
<I18n
|
||||||
|
:src="tlHint"
|
||||||
|
>
|
||||||
|
<template #icon></template>
|
||||||
|
</I18n>
|
||||||
|
</MkInfo>
|
||||||
<XNotes
|
<XNotes
|
||||||
ref="tlComponent"
|
ref="tlComponent"
|
||||||
:no-gap="!$store.state.showGapBetweenNotesInTimeline"
|
:no-gap="!$store.state.showGapBetweenNotesInTimeline"
|
||||||
@ -10,10 +17,13 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, provide, onUnmounted } from "vue";
|
import { ref, computed, provide, onUnmounted } from "vue";
|
||||||
import XNotes from "@/components/MkNotes.vue";
|
import XNotes from "@/components/MkNotes.vue";
|
||||||
|
import MkInfo from "@/components/MkInfo.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { stream } from "@/stream";
|
import { stream } from "@/stream";
|
||||||
import * as sound from "@/scripts/sound";
|
import * as sound from "@/scripts/sound";
|
||||||
import { $i } from "@/account";
|
import { $i } from "@/account";
|
||||||
|
import { i18n } from "@/i18n";
|
||||||
|
import { defaultStore } from "@/store";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
src: string;
|
src: string;
|
||||||
@ -64,6 +74,9 @@ let query;
|
|||||||
let connection;
|
let connection;
|
||||||
let connection2;
|
let connection2;
|
||||||
|
|
||||||
|
let tlHint;
|
||||||
|
let tlHintClosed;
|
||||||
|
|
||||||
if (props.src === "antenna") {
|
if (props.src === "antenna") {
|
||||||
endpoint = "antennas/notes";
|
endpoint = "antennas/notes";
|
||||||
query = {
|
query = {
|
||||||
@ -81,22 +94,37 @@ if (props.src === "antenna") {
|
|||||||
connection2 = stream.useChannel("main");
|
connection2 = stream.useChannel("main");
|
||||||
connection2.on("follow", onChangeFollowing);
|
connection2.on("follow", onChangeFollowing);
|
||||||
connection2.on("unfollow", onChangeFollowing);
|
connection2.on("unfollow", onChangeFollowing);
|
||||||
|
|
||||||
|
tlHint = i18n.ts._tutorial.step5_3;
|
||||||
|
tlHintClosed = defaultStore.state.tlHomeHintClosed;
|
||||||
} else if (props.src === "local") {
|
} else if (props.src === "local") {
|
||||||
endpoint = "notes/local-timeline";
|
endpoint = "notes/local-timeline";
|
||||||
connection = stream.useChannel("localTimeline");
|
connection = stream.useChannel("localTimeline");
|
||||||
connection.on("note", prepend);
|
connection.on("note", prepend);
|
||||||
|
|
||||||
|
tlHint = i18n.ts._tutorial.step5_4;
|
||||||
|
tlHintClosed = defaultStore.state.tlLocalHintClosed;
|
||||||
} else if (props.src === "recommended") {
|
} else if (props.src === "recommended") {
|
||||||
endpoint = "notes/recommended-timeline";
|
endpoint = "notes/recommended-timeline";
|
||||||
connection = stream.useChannel("recommendedTimeline");
|
connection = stream.useChannel("recommendedTimeline");
|
||||||
connection.on("note", prepend);
|
connection.on("note", prepend);
|
||||||
|
|
||||||
|
tlHint = i18n.ts._tutorial.step5_6;
|
||||||
|
tlHintClosed = defaultStore.state.tlRecommendedHintClosed;
|
||||||
} else if (props.src === "social") {
|
} else if (props.src === "social") {
|
||||||
endpoint = "notes/hybrid-timeline";
|
endpoint = "notes/hybrid-timeline";
|
||||||
connection = stream.useChannel("hybridTimeline");
|
connection = stream.useChannel("hybridTimeline");
|
||||||
connection.on("note", prepend);
|
connection.on("note", prepend);
|
||||||
|
|
||||||
|
tlHint = i18n.ts._tutorial.step5_5;
|
||||||
|
tlHintClosed = defaultStore.state.tlSocialHintClosed;
|
||||||
} else if (props.src === "global") {
|
} else if (props.src === "global") {
|
||||||
endpoint = "notes/global-timeline";
|
endpoint = "notes/global-timeline";
|
||||||
connection = stream.useChannel("globalTimeline");
|
connection = stream.useChannel("globalTimeline");
|
||||||
connection.on("note", prepend);
|
connection.on("note", prepend);
|
||||||
|
|
||||||
|
tlHint = i18n.ts._tutorial.step5_7;
|
||||||
|
tlHintClosed = defaultStore.state.tlGlobalHintClosed;
|
||||||
} else if (props.src === "mentions") {
|
} else if (props.src === "mentions") {
|
||||||
endpoint = "notes/mentions";
|
endpoint = "notes/mentions";
|
||||||
connection = stream.useChannel("main");
|
connection = stream.useChannel("main");
|
||||||
@ -135,6 +163,26 @@ if (props.src === "antenna") {
|
|||||||
connection.on("note", prepend);
|
connection.on("note", prepend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeHint() {
|
||||||
|
switch (props.src) {
|
||||||
|
case 'home':
|
||||||
|
defaultStore.set("tlHomeHintClosed", true);
|
||||||
|
break;
|
||||||
|
case 'local':
|
||||||
|
defaultStore.set("tlLocalHintClosed", true);
|
||||||
|
break;
|
||||||
|
case 'recommended':
|
||||||
|
defaultStore.set("tlRecommendedHintClosed", true);
|
||||||
|
break;
|
||||||
|
case 'social':
|
||||||
|
defaultStore.set("tlSocialHintClosed", true);
|
||||||
|
break;
|
||||||
|
case 'global':
|
||||||
|
defaultStore.set("tlGlobalHintClosed", true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const pagination = {
|
const pagination = {
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
|
@ -26,6 +26,26 @@ export const defaultStore = markRaw(
|
|||||||
where: "account",
|
where: "account",
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
|
tlHomeHintClosed: {
|
||||||
|
where: "device",
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
tlLocalHintClosed: {
|
||||||
|
where: "device",
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
tlRecommendedHintClosed: {
|
||||||
|
where: "device",
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
tlSocialHintClosed: {
|
||||||
|
where: "device",
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
tlGlobalHintClosed: {
|
||||||
|
where: "device",
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
keepCw: {
|
keepCw: {
|
||||||
where: "account",
|
where: "account",
|
||||||
default: true,
|
default: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user