Skip to content

Commit

Permalink
spec(frontend): kawaii モード
Browse files Browse the repository at this point in the history
  • Loading branch information
u1-liquid committed May 15, 2024
1 parent 3b41cfe commit b891bee
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 6 deletions.
20 changes: 20 additions & 0 deletions packages/frontend/assets/kawaii/LICENSE_MisskeyHQ
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
LICENSE
-------

The following files:

- misskey-io.png

are owned by MisskeyHQ and are subject to copyright, with all rights reserved by MisskeyHQ. These files may not be redistributed, modified, or reused in any way without explicit permission from MisskeyHQ.

Copyright (c) 2024 MisskeyHQ

All rights reserved.

This digital asset and related documentation are the property of MisskeyHQ.

Permission is hereby granted to the user of this digital asset and related documentation to use, copy, and publish the asset for any purpose, provided that this notice and disclaimer of warranty appears in all copies. The user is expressly prohibited from distributing, sublicensing, selling, reselling, or transferring the asset for profit. Any form of modification or tampering with the asset is strictly prohibited.

IN NO EVENT SHALL MISSKEYHQ BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING BUT NOT LIMITED TO DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES, ARISING OUT OF THE USE, COPYING, PUBLISHING, OR MODIFICATION OF THIS ASSET.

NO WARRANTIES OF ANY KIND ARE OFFERED FOR THIS ASSET. THIS ASSET IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
12 changes: 12 additions & 0 deletions packages/frontend/assets/kawaii/LICENSE_SAWARATSUKI
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
LICENSE
-------

Copyright (c) by [さわらつき](https://github.com/SAWARATSUKI)

The following files:

- about-icon.png

are licensed under a Creative Commons Attribution 4.0 International License.
These files SHOULD NOT be considered as a part of the this project that has licensed under AGPL-3.0-only
You should have received a copy of the license along with this work. If not, see <https://creativecommons.org/licenses/by/4.0/>.
Binary file added packages/frontend/assets/kawaii/about-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/frontend/assets/kawaii/misskey-io.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion packages/frontend/src/boot/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ export async function common(createVue: () => App<Element>) {
miLocalStorage.setItem('v', instance.version);
});

//#region loginId
const params = new URLSearchParams(location.search);
//#region loginId
const loginId = params.get('loginId');

if (loginId) {
Expand All @@ -142,6 +142,14 @@ export async function common(createVue: () => App<Element>) {
}
//#endregion

//#region kawaii
if (params.has('kawaii')) {
miLocalStorage.setItem('kawaii', 'true');
} else {
miLocalStorage.removeItem('kawaii');
}
//#endregion

// NOTE: この処理は必ずクライアント更新チェック処理より後に来ること(テーマ再構築のため)
watch(defaultStore.reactiveState.darkMode, (darkMode) => {
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
Expand Down
11 changes: 10 additions & 1 deletion packages/frontend/src/components/MkVisitorDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div v-if="instance" :class="$style.root">
<div :class="[$style.main, $style.panel]">
<img :src="instance.iconUrl || '/favicon.ico'" alt="" :class="$style.mainIcon"/>
<img v-if="miLocalStorage.getItem('kawaii')" src="/client-assets/kawaii/misskey-io.png" alt="Logo by @[email protected]" :class="$style.mainIconAlt"/>
<img v-else :src="instance.iconUrl || '/favicon.ico'" alt="" :class="$style.mainIcon"/>
<button class="_button _acrylic" :class="$style.mainMenu" @click="showMenu"><i class="ti ti-dots"></i></button>
<div :class="$style.mainFg">
<h1 :class="$style.mainTitle">
Expand Down Expand Up @@ -81,6 +82,7 @@ import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import { miLocalStorage } from '@/local-storage.js';
import MkNumber from '@/components/MkNumber.vue';
import XActiveUsersChart from '@/components/MkVisitorDashboard.ActiveUsersChart.vue';
import { openInstanceMenu } from '@/ui/_common_/common';
Expand Down Expand Up @@ -139,6 +141,13 @@ function exploreOtherServers() {
filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}
.mainIconAlt {
width: 85%;
margin-top: -47px;
vertical-align: bottom;
filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}
.mainMenu {
position: absolute;
top: 16px;
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/local-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ type Keys =
`aiscript:${string}` |
'lastEmojisFetchedAt' | // DEPRECATED, stored in indexeddb (13.9.0~)
'emojis' | // DEPRECATED, stored in indexeddb (13.9.0~);
`channelLastReadedAt:${string}`
`channelLastReadedAt:${string}` |
'kawaii'

export const miLocalStorage = {
getItem: (key: Keys): string | null => window.localStorage.getItem(key),
Expand Down
20 changes: 19 additions & 1 deletion packages/frontend/src/pages/about-misskey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_gaps_m znqjceqz">
<div v-panel class="about">
<div ref="containerEl" class="container" :class="{ playing: easterEggEngine != null }">
<img src="/client-assets/about-icon.png" alt="" class="icon" draggable="false" @load="iconLoaded" @click="gravity"/>
<img v-if="miLocalStorage.getItem('kawaii')" src="/client-assets/kawaii/about-icon.png" alt="" class="iconAlt" draggable="false" @load="iconLoaded" @click="gravity"/>
<img v-else src="/client-assets/about-icon.png" alt="" class="icon" draggable="false" @load="iconLoaded" @click="gravity"/>
<Mfm v-if="miLocalStorage.getItem('kawaii')" text="Logo by @[email protected]" class="iconCredit"/>
<div class="misskey">Misskey</div>
<div class="version">v{{ version }}</div>
<span v-for="emoji in easterEggEmojis" :key="emoji.id" class="emoji" :data-physics-x="emoji.left" :data-physics-y="emoji.top" :class="{ _physics_circle_: !emoji.emoji.startsWith(':') }">
Expand Down Expand Up @@ -137,6 +139,7 @@ import { physics } from '@/scripts/physics.js';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import { defaultStore } from '@/store.js';
import { miLocalStorage } from '@/local-storage.js';
import * as os from '@/os.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { claimAchievement, claimedAchievements } from '@/scripts/achievements.js';
Expand Down Expand Up @@ -443,6 +446,21 @@ definePageMetadata(() => ({
z-index: 1;
}
> .iconAlt {
display: block;
width: 85%;
margin: 0 auto;
position: relative;
z-index: 1;
}
> .iconCredit {
margin: 0 auto;
width: max-content;
position: relative;
z-index: 1;
}
> .misskey {
margin: 0.75em auto 0 auto;
width: max-content;
Expand Down
18 changes: 17 additions & 1 deletion packages/frontend/src/pages/about.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_gaps_m">
<div :class="$style.banner" :style="{ backgroundImage: `url(${ instance.bannerUrl })` }">
<div style="overflow: clip;">
<img :src="instance.iconUrl ?? instance.faviconUrl ?? '/favicon.ico'" alt="" :class="$style.bannerIcon"/>
<img v-if="miLocalStorage.getItem('kawaii')" src="/client-assets/kawaii/misskey-io.png" alt="" :class="$style.bannerIconAlt"/>
<img v-else :src="instance.iconUrl ?? instance.faviconUrl ?? '/favicon.ico'" alt="" :class="$style.bannerIcon"/>
<Mfm v-if="miLocalStorage.getItem('kawaii')" text="Logo by @sawaratsuki@misskey.io" :class="$style.iconCredit"/>
<div :class="$style.bannerName">
<b>{{ instance.name ?? host }}</b>
</div>
Expand Down Expand Up @@ -168,6 +170,7 @@ import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { claimAchievement } from '@/scripts/achievements.js';
import { instance } from '@/instance.js';
import { miLocalStorage } from '@/local-storage.js';
const props = withDefaults(defineProps<{
initialTab?: string;
Expand Down Expand Up @@ -230,6 +233,12 @@ definePageMetadata(() => ({
border-radius: 8px;
}
.bannerIconAlt {
display: block;
margin: 16px auto 0 auto;
width: 85%;
}
.bannerName {
display: block;
padding: 16px;
Expand All @@ -238,6 +247,13 @@ definePageMetadata(() => ({
background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}
> .iconCredit {
margin: 0 auto;
width: max-content;
position: relative;
z-index: 1;
}
.rules {
counter-reset: item;
list-style: none;
Expand Down
9 changes: 8 additions & 1 deletion packages/frontend/src/ui/_common_/navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<div :class="$style.top">
<div :class="$style.banner" :style="{ backgroundImage: `url(${ instance.bannerUrl })` }"></div>
<button v-tooltip.noDelay.right="instance.name ?? i18n.ts.instance" class="_button" :class="$style.instance" @click="openInstanceMenu">
<img :src="instance.iconUrl || instance.faviconUrl || '/favicon.ico'" alt="" :class="$style.instanceIcon"/>
<img v-if="miLocalStorage.getItem('kawaii')" src="/client-assets/kawaii/misskey-io.png" alt="" :class="$style.instanceIconAlt"/>
<img v-else :src="instance.iconUrl || instance.faviconUrl || '/favicon.ico'" alt="" :class="$style.instanceIcon"/>
</button>
</div>
<div :class="$style.middle">
Expand Down Expand Up @@ -68,6 +69,7 @@ import { $i, openAccountMenu as openAccountMenu_ } from '@/account.js';
import { defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import { miLocalStorage } from '@/local-storage.js';
const iconOnly = ref(false);
Expand Down Expand Up @@ -173,6 +175,11 @@ function more(ev: MouseEvent) {
aspect-ratio: 1;
}
.instanceIconAlt {
display: inline-block;
width: 85%;
}
.bottom {
position: sticky;
bottom: 0;
Expand Down

0 comments on commit b891bee

Please sign in to comment.