Home button

This commit is contained in:
Freeplay 2023-06-14 18:14:51 -04:00
parent b73dd890ef
commit 69595a400b
3 changed files with 38 additions and 23 deletions

View file

@ -9,15 +9,16 @@
> >
<div class="left"> <div class="left">
<div class="buttons"> <div class="buttons">
<MkA <!-- <MkA
v-if="!$i" v-if="!$i && displayHomeButton"
class="_buttonIcon button icon backButton" class="_buttonIcon button icon backButton"
:to="'/'" :to="'/'"
v-tooltip="i18n.ts.home"
> >
<i class="ph-list ph-bold ph-lg"></i> <i class="ph-house ph-bold ph-lg"></i>
</MkA> </MkA> -->
<button <button
v-else-if="displayBackButton" v-if="displayBackButton"
class="_buttonIcon button icon backButton" class="_buttonIcon button icon backButton"
@click.stop="goBack()" @click.stop="goBack()"
@touchstart="preventDrag" @touchstart="preventDrag"
@ -98,6 +99,15 @@
</nav> </nav>
</template> </template>
<div class="buttons right"> <div class="buttons right">
<MkButton
v-if="!$i && displayHomeButton"
:to="'/'"
link
rounded
>
<i class="ph-house ph-bold ph-lg"></i>
{{ i18n.ts.home }}
</MkButton>
<template v-if="metadata.avatar && $i"> <template v-if="metadata.avatar && $i">
<MkFollowButton <MkFollowButton
v-if="narrow" v-if="narrow"
@ -140,6 +150,7 @@ import {
reactive, reactive,
} from "vue"; } from "vue";
import MkFollowButton from "@/components/MkFollowButton.vue"; import MkFollowButton from "@/components/MkFollowButton.vue";
import MkButton from "@/components/MkButton.vue";
import { popupMenu } from "@/os"; import { popupMenu } from "@/os";
import { scrollToTop } from "@/scripts/scroll"; import { scrollToTop } from "@/scripts/scroll";
import { globalEvents } from "@/events"; import { globalEvents } from "@/events";
@ -155,7 +166,8 @@ type Tab = {
onClick?: (ev: MouseEvent) => void; onClick?: (ev: MouseEvent) => void;
}; };
const props = defineProps<{ const props = withDefaults(
defineProps<{
tabs?: Tab[]; tabs?: Tab[];
tab?: string; tab?: string;
noTabCollapse?: boolean; noTabCollapse?: boolean;
@ -167,8 +179,14 @@ const props = defineProps<{
thin?: boolean; thin?: boolean;
displayMyAvatar?: boolean; displayMyAvatar?: boolean;
displayBackButton?: boolean; displayBackButton?: boolean;
displayHomeButton?: boolean;
to?: string; to?: string;
}>(); }>(),
{
displayHomeButton: !$i
}
)
const displayBackButton = const displayBackButton =
props.displayBackButton && props.displayBackButton &&

View file

@ -6,6 +6,7 @@
:actions="headerActions" :actions="headerActions"
:tabs="headerTabs" :tabs="headerTabs"
:noTabCollapse="true" :noTabCollapse="true"
:displayHomeButton="false"
/></template> /></template>
<div id="visitor-view"> <div id="visitor-view">
<swiper <swiper

View file

@ -191,10 +191,6 @@ matchMedia("(max-width: 1000px)").onchange = (mql) => {
expanded = true; expanded = true;
defineProps<{
poweredBy?: boolean,
}>()
let meta = $ref<DetailedInstanceMetadata>(); let meta = $ref<DetailedInstanceMetadata>();
let isLong = $ref(false); let isLong = $ref(false);