Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): GTL上でのサーバー表示をインスタンスのロゴのみに切り替えできるように #14141

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2840,6 +2840,10 @@ export interface Locale extends ILocale {
* ノートのサーバー情報
*/
"instanceTicker": string;
/**
* サーバー情報をアイコンのみにする
*/
"instanceIcon": string;
/**
* {x}を待っています
*/
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ openInSideView: "サイドビューで開く"
defaultNavigationBehaviour: "デフォルトのナビゲーション"
editTheseSettingsMayBreakAccount: "これらの設定を編集するとアカウントが破損する可能性があります。"
instanceTicker: "ノートのサーバー情報"
instanceIcon: "サーバー情報をアイコンのみにする"
waitingFor: "{x}を待っています"
random: "ランダム"
system: "システム"
Expand Down
56 changes: 56 additions & 0 deletions packages/frontend/src/components/MkInstanceIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<div>
<img v-if="faviconUrl" :class="$style.topleftIcon" :src="faviconUrl"/>
</div>
</template>

<script lang="ts" setup>
import { computed } from 'vue';
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';

const props = defineProps<{
instance?: {
faviconUrl?: string | null
}
}>();

const faviconUrl = computed(() => getProxiedImageUrlNullable(props.instance?.faviconUrl, 'preview') ?? '/favicon.ico');

</script>

<style lang="scss" module>
.topleftIcon {
width: 25px;
height: 25px;
border-radius: 50%;
opacity: 0.7;
background: var(--panel);
box-shadow: 0 0 0 2px var(--panel);
}

@container (max-width: 580px) {
.topleftIcon {
width: 21px;
height: 21px;
}
}

@container (max-width: 450px) {
.topleftIcon {
width: 19px;
height: 19px;
}
}

@container (max-width: 300px) {
.topleftIcon {
width: 17px;
height: 17px;
}
}
</style>
36 changes: 35 additions & 1 deletion packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<article v-else :class="$style.article" @contextmenu.stop="onContextmenu">
<div v-if="appearNote.channel" :class="$style.colorBar" :style="{ background: appearNote.channel.color }"></div>
<MkInstanceIcon v-if="showInstanceIcon && showTicker" :class="$style.instanceicon"/>
<MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock"/>
<div :class="$style.main">
<MkNoteHeader :note="appearNote" :mini="true"/>
<MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/>
<MkInstanceTicker v-if="showTicker && !showInstanceIcon" :instance="appearNote.user.instance"/>
<div style="container-type: inline-size;">
<p v-if="appearNote.cw != null" :class="$style.cw">
<Mfm v-if="appearNote.cw != ''" style="margin-right: 8px;" :text="appearNote.cw" :author="appearNote.user" :nyaize="'respect'"/>
Expand Down Expand Up @@ -174,6 +175,7 @@ import MkPoll from '@/components/MkPoll.vue';
import MkUsersTooltip from '@/components/MkUsersTooltip.vue';
import MkUrlPreview from '@/components/MkUrlPreview.vue';
import MkInstanceTicker from '@/components/MkInstanceTicker.vue';
import MkInstanceIcon from '@/components/MkInstanceIcon.vue';
import { pleaseLogin } from '@/scripts/please-login.js';
import { focusPrev, focusNext } from '@/scripts/focus.js';
import { checkWordMute } from '@/scripts/check-word-mute.js';
Expand Down Expand Up @@ -267,6 +269,7 @@ const muted = ref(checkMute(appearNote.value, $i?.mutedWords));
const hardMuted = ref(props.withHardMute && checkMute(appearNote.value, $i?.hardMutedWords, true));
const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null);
const translating = ref(false);
const showInstanceIcon = ref(defaultStore.state.instanceIcon);
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
const renoteCollapsed = ref(
Expand Down Expand Up @@ -783,6 +786,16 @@ function emitUpdReaction(emoji: string, delta: number) {
left: 0;
}

.instanceicon {
display: block !important;
padding-top: 33px;
margin-right: -25px;
height: 25px;
z-index: 10;
position: sticky !important;
top: calc(22px + var(--stickyTop, 0px));
}

.main {
flex: 1;
min-width: 0;
Expand Down Expand Up @@ -923,6 +936,12 @@ function emitUpdReaction(emoji: string, delta: number) {
width: 50px;
height: 50px;
}

.instanceicon {
padding-top: 29px;
height: 21px;
margin-right: -21px;
}
}

@container (max-width: 500px) {
Expand All @@ -938,6 +957,10 @@ function emitUpdReaction(emoji: string, delta: number) {
padding: 20px 22px;
}

.instanceicon {
top: calc(14px + var(--stickyTop, 0px));
}

.footer {
margin-bottom: -8px;
}
Expand Down Expand Up @@ -969,6 +992,12 @@ function emitUpdReaction(emoji: string, delta: number) {
height: 46px;
top: calc(14px + var(--stickyTop, 0px));
}

.instanceicon {
padding-top: 27px;
height: 19px;
margin-right: -19px;
}
}

@container (max-width: 400px) {
Expand All @@ -979,6 +1008,11 @@ function emitUpdReaction(emoji: string, delta: number) {
}
}
}

.instanceicon {
height: 17px;
margin-right: -17px;
}
}

@container (max-width: 350px) {
Expand Down
6 changes: 4 additions & 2 deletions packages/frontend/src/pages/settings/general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only

<FormSection>
<template #label>{{ i18n.ts.displayOfNote }}</template>

<div class="_gaps_m">
<div class="_gaps_s">
<MkSwitch v-model="collapseRenotes">
Expand Down Expand Up @@ -77,7 +77,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="remote">{{ i18n.ts._instanceTicker.remote }}</option>
<option value="always">{{ i18n.ts._instanceTicker.always }}</option>
</MkSelect>

<MkSwitch v-if="instanceTicker !== 'none'" v-model="instanceIcon">{{ i18n.ts.instanceIcon }}</MkSwitch>
<MkSelect v-model="nsfw">
<template #label>{{ i18n.ts.displayOfSensitiveMedia }}</template>
<option value="respect">{{ i18n.ts._displayOfSensitiveMedia.respect }}</option>
Expand Down Expand Up @@ -301,6 +301,7 @@ const showFixedPostForm = computed(defaultStore.makeGetterSetter('showFixedPostF
const showFixedPostFormInChannel = computed(defaultStore.makeGetterSetter('showFixedPostFormInChannel'));
const numberOfPageCache = computed(defaultStore.makeGetterSetter('numberOfPageCache'));
const instanceTicker = computed(defaultStore.makeGetterSetter('instanceTicker'));
const instanceIcon = computed(defaultStore.makeGetterSetter('instanceIcon'));
const enableInfiniteScroll = computed(defaultStore.makeGetterSetter('enableInfiniteScroll'));
const useReactionPickerForContextMenu = computed(defaultStore.makeGetterSetter('useReactionPickerForContextMenu'));
const squareAvatars = computed(defaultStore.makeGetterSetter('squareAvatars'));
Expand Down Expand Up @@ -348,6 +349,7 @@ watch([
showNoteActionsOnlyHover,
showGapBetweenNotesInTimeline,
instanceTicker,
instanceIcon,
overridedDeviceKind,
mediaListWithOneImageAppearance,
reactionsDisplaySize,
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: 'remote' as 'none' | 'remote' | 'always',
},
instanceIcon: {
where: 'device',
default: false,
},
emojiPickerScale: {
where: 'device',
default: 1,
Expand Down
Loading