Merge branch 'develop' into feat/idle-render
This commit is contained in:
commit
714206a924
21 changed files with 432 additions and 54 deletions
|
|
@ -484,6 +484,11 @@ function showReactions(): void {
|
|||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&:hover > .article > .main > .footer > .footerButton {
|
||||
opacity: 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -900,27 +900,28 @@ defineExpose({
|
|||
}
|
||||
|
||||
.headerLeft {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(36px, 50px));
|
||||
grid-template-rows: minmax(40px, 100%);
|
||||
display: flex;
|
||||
flex: 0 1 100px;
|
||||
}
|
||||
|
||||
.cancel {
|
||||
padding: 0;
|
||||
font-size: 1em;
|
||||
height: 100%;
|
||||
flex: 0 1 50px;
|
||||
}
|
||||
|
||||
.account {
|
||||
height: 100%;
|
||||
display: inline-flex;
|
||||
vertical-align: bottom;
|
||||
flex: 0 1 50px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
margin: auto 0;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.headerRight {
|
||||
|
|
|
|||
|
|
@ -1,21 +1,22 @@
|
|||
import { miLocalStorage } from "./local-storage";
|
||||
import { miLocalStorage } from './local-storage';
|
||||
|
||||
const address = new URL(location.href);
|
||||
const siteName = (document.querySelector('meta[property="og:site_name"]') as HTMLMetaElement)?.content;
|
||||
const siteName = document.querySelector<HTMLMetaElement>('meta[property="og:site_name"]')?.content;
|
||||
|
||||
export const host = address.host;
|
||||
export const hostname = address.hostname;
|
||||
export const url = address.origin;
|
||||
export const apiUrl = url + '/api';
|
||||
export const wsUrl = url.replace('http://', 'ws://').replace('https://', 'wss://') + '/streaming';
|
||||
export const lang = miLocalStorage.getItem('lang');
|
||||
export const lang = miLocalStorage.getItem('lang') ?? 'en-US';
|
||||
export const langs = _LANGS_;
|
||||
export let locale = JSON.parse(miLocalStorage.getItem('locale'));
|
||||
const preParseLocale = miLocalStorage.getItem('locale');
|
||||
export let locale = preParseLocale ? JSON.parse(preParseLocale) : null;
|
||||
export const version = _VERSION_;
|
||||
export const instanceName = siteName === 'Misskey' ? host : siteName;
|
||||
export const ui = miLocalStorage.getItem('ui');
|
||||
export const debug = miLocalStorage.getItem('debug') === 'true';
|
||||
|
||||
export function updateLocale(newLocale) {
|
||||
export function updateLocale(newLocale): void {
|
||||
locale = newLocale;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,18 +6,6 @@ import 'vite/modulepreload-polyfill';
|
|||
|
||||
import '@/style.scss';
|
||||
|
||||
//#region account indexedDB migration
|
||||
import { set } from '@/scripts/idb-proxy';
|
||||
|
||||
{
|
||||
const accounts = miLocalStorage.getItem('accounts');
|
||||
if (accounts) {
|
||||
set('accounts', JSON.parse(accounts));
|
||||
miLocalStorage.removeItem('accounts');
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
import { computed, createApp, watch, markRaw, version as vueVersion, defineAsyncComponent } from 'vue';
|
||||
import { compareVersions } from 'compare-versions';
|
||||
import JSON5 from 'json5';
|
||||
|
|
@ -42,11 +30,11 @@ import { reloadChannel } from '@/scripts/unison-reload';
|
|||
import { reactionPicker } from '@/scripts/reaction-picker';
|
||||
import { getUrlWithoutLoginId } from '@/scripts/login-id';
|
||||
import { getAccountFromId } from '@/scripts/get-account-from-id';
|
||||
import { deckStore } from './ui/deck/deck-store';
|
||||
import { miLocalStorage } from './local-storage';
|
||||
import { claimAchievement, claimedAchievements } from './scripts/achievements';
|
||||
import { fetchCustomEmojis } from './custom-emojis';
|
||||
import { mainRouter } from './router';
|
||||
import { deckStore } from '@/ui/deck/deck-store';
|
||||
import { miLocalStorage } from '@/local-storage';
|
||||
import { claimAchievement, claimedAchievements } from '@/scripts/achievements';
|
||||
import { fetchCustomEmojis } from '@/custom-emojis';
|
||||
import { mainRouter } from '@/router';
|
||||
|
||||
console.info(`Misskey v${version}`);
|
||||
|
||||
|
|
@ -55,7 +43,9 @@ if (_DEV_) {
|
|||
|
||||
console.info(`vue ${vueVersion}`);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(window as any).$i = $i;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(window as any).$store = defaultStore;
|
||||
|
||||
window.addEventListener('error', event => {
|
||||
|
|
@ -184,7 +174,7 @@ fetchInstanceMetaPromise.then(() => {
|
|||
|
||||
try {
|
||||
await fetchCustomEmojis();
|
||||
} catch (err) {}
|
||||
} catch (err) { /* empty */ }
|
||||
|
||||
const app = createApp(
|
||||
new URLSearchParams(window.location.search).has('zen') ? defineAsyncComponent(() => import('@/ui/zen.vue')) :
|
||||
|
|
@ -212,20 +202,20 @@ await deckStore.ready;
|
|||
|
||||
// https://github.com/misskey-dev/misskey/pull/8575#issuecomment-1114239210
|
||||
// なぜかinit.tsの内容が2回実行されることがあるため、mountするdivを1つに制限する
|
||||
const rootEl = (() => {
|
||||
const rootEl = ((): HTMLElement => {
|
||||
const MISSKEY_MOUNT_DIV_ID = 'misskey_app';
|
||||
|
||||
const currentEl = document.getElementById(MISSKEY_MOUNT_DIV_ID);
|
||||
const currentRoot = document.getElementById(MISSKEY_MOUNT_DIV_ID);
|
||||
|
||||
if (currentEl) {
|
||||
if (currentRoot) {
|
||||
console.warn('multiple import detected');
|
||||
return currentEl;
|
||||
return currentRoot;
|
||||
}
|
||||
|
||||
const rootEl = document.createElement('div');
|
||||
rootEl.id = MISSKEY_MOUNT_DIV_ID;
|
||||
document.body.appendChild(rootEl);
|
||||
return rootEl;
|
||||
const root = document.createElement('div');
|
||||
root.id = MISSKEY_MOUNT_DIV_ID;
|
||||
document.body.appendChild(root);
|
||||
return root;
|
||||
})();
|
||||
|
||||
app.mount(rootEl);
|
||||
|
|
@ -256,8 +246,7 @@ if (lastVersion !== version) {
|
|||
popup(defineAsyncComponent(() => import('@/components/MkUpdated.vue')), {}, {}, 'closed');
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
}
|
||||
} catch (err) { /* empty */ }
|
||||
}
|
||||
|
||||
await defaultStore.ready;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ type Keys =
|
|||
'customCss' |
|
||||
'message_drafts' |
|
||||
'scratchpad' |
|
||||
'debug' |
|
||||
`miux:${string}` |
|
||||
`ui:folder:${string}` |
|
||||
`themes:${string}` |
|
||||
|
|
@ -32,7 +33,7 @@ type Keys =
|
|||
'emojis' // DEPRECATED, stored in indexeddb (13.9.0~);
|
||||
|
||||
export const miLocalStorage = {
|
||||
getItem: (key: Keys) => window.localStorage.getItem(key),
|
||||
setItem: (key: Keys, value: string) => window.localStorage.setItem(key, value),
|
||||
removeItem: (key: Keys) => window.localStorage.removeItem(key),
|
||||
getItem: (key: Keys): string | null => window.localStorage.getItem(key),
|
||||
setItem: (key: Keys, value: string): void => window.localStorage.setItem(key, value),
|
||||
removeItem: (key: Keys): void => window.localStorage.removeItem(key),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@
|
|||
<span v-if="user.isAdmin" :title="i18n.ts.isAdmin" style="color: var(--badge);"><i class="ti ti-shield"></i></span>
|
||||
<span v-if="user.isLocked" :title="i18n.ts.isLocked"><i class="ti ti-lock"></i></span>
|
||||
<span v-if="user.isBot" :title="i18n.ts.isBot"><i class="ti ti-robot"></i></span>
|
||||
<button v-if="!isEditingMemo && !memoDraft" class="_button add-note-button" @click="showMemoTextarea">
|
||||
<i class="ti ti-edit"/> {{ i18n.ts.addMemo }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<span v-if="$i && $i.id != user.id && user.isFollowed" class="followed">{{ i18n.ts.followsYou }}</span>
|
||||
|
|
@ -39,6 +42,17 @@
|
|||
<span v-if="user.isBot" :title="i18n.ts.isBot"><i class="ti ti-robot"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isEditingMemo || memoDraft" class="memo" :class="{'no-memo': !memoDraft}">
|
||||
<div class="heading" v-text="i18n.ts.memo"/>
|
||||
<textarea
|
||||
ref="memoTextareaEl"
|
||||
v-model="memoDraft"
|
||||
rows="1"
|
||||
@focus="isEditingMemo = true"
|
||||
@blur="updateMemo"
|
||||
@input="adjustMemoTextarea"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="user.roles.length > 0" class="roles">
|
||||
<span v-for="role in user.roles" :key="role.id" v-tooltip="role.description" class="role" :style="{ '--color': role.color }">
|
||||
<img v-if="role.iconUrl" style="height: 1.3em; vertical-align: -22%;" :src="role.iconUrl"/>
|
||||
|
|
@ -113,7 +127,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { defineAsyncComponent, computed, onMounted, onUnmounted } from 'vue';
|
||||
import { defineAsyncComponent, computed, onMounted, onUnmounted, nextTick, watch } from 'vue';
|
||||
import calcAge from 's-age';
|
||||
import * as misskey from 'misskey-js';
|
||||
import MkNote from '@/components/MkNote.vue';
|
||||
|
|
@ -133,6 +147,7 @@ import { $i } from '@/account';
|
|||
import { dateString } from '@/filters/date';
|
||||
import { confetti } from '@/scripts/confetti';
|
||||
import MkNotes from '@/components/MkNotes.vue';
|
||||
import { api } from '@/os';
|
||||
|
||||
const XPhotos = defineAsyncComponent(() => import('./index.photos.vue'));
|
||||
const XActivity = defineAsyncComponent(() => import('./index.activity.vue'));
|
||||
|
|
@ -151,6 +166,10 @@ let parallaxAnimationId = $ref<null | number>(null);
|
|||
let narrow = $ref<null | boolean>(null);
|
||||
let rootEl = $ref<null | HTMLElement>(null);
|
||||
let bannerEl = $ref<null | HTMLElement>(null);
|
||||
let memoTextareaEl = $ref<null | HTMLElement>(null);
|
||||
let memoDraft = $ref(props.user.memo);
|
||||
|
||||
let isEditingMemo = $ref(false);
|
||||
|
||||
const pagination = {
|
||||
endpoint: 'users/notes' as const,
|
||||
|
|
@ -193,6 +212,31 @@ function parallax() {
|
|||
banner.style.backgroundPosition = `center calc(50% - ${pos}px)`;
|
||||
}
|
||||
|
||||
function showMemoTextarea() {
|
||||
isEditingMemo = true;
|
||||
nextTick(() => {
|
||||
memoTextareaEl?.focus();
|
||||
});
|
||||
}
|
||||
|
||||
function adjustMemoTextarea() {
|
||||
if (!memoTextareaEl) return;
|
||||
memoTextareaEl.style.height = '0px';
|
||||
memoTextareaEl.style.height = `${memoTextareaEl.scrollHeight}px`;
|
||||
}
|
||||
|
||||
async function updateMemo() {
|
||||
await api('users/update-memo', {
|
||||
memo: memoDraft,
|
||||
userId: props.user.id,
|
||||
});
|
||||
isEditingMemo = false;
|
||||
}
|
||||
|
||||
watch([props.user], () => {
|
||||
memoDraft = props.user.memo;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
window.requestAnimationFrame(parallaxLoop);
|
||||
narrow = rootEl!.clientWidth < 1000;
|
||||
|
|
@ -208,6 +252,9 @@ onMounted(() => {
|
|||
});
|
||||
}
|
||||
}
|
||||
nextTick(() => {
|
||||
adjustMemoTextarea();
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
|
@ -323,6 +370,16 @@ onUnmounted(() => {
|
|||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
> .add-note-button {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
color: #fff;
|
||||
-webkit-backdrop-filter: var(--blur, blur(8px));
|
||||
backdrop-filter: var(--blur, blur(8px));
|
||||
border-radius: 24px;
|
||||
padding: 4px 8px;
|
||||
font-size: 80%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -369,6 +426,38 @@ onUnmounted(() => {
|
|||
}
|
||||
}
|
||||
|
||||
> .memo {
|
||||
margin: 12px 24px 0 154px;
|
||||
background: transparent;
|
||||
color: var(--fg);
|
||||
border: 1px solid var(--divider);
|
||||
border-radius: 8px;
|
||||
padding: 8px;
|
||||
line-height: 0;
|
||||
|
||||
> .heading {
|
||||
text-align: left;
|
||||
color: var(--fgTransparent);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
textarea {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
resize: none;
|
||||
border: none;
|
||||
outline: none;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
min-height: 0;
|
||||
line-height: 1.5;
|
||||
color: var(--fg);
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
font-family: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
> .description {
|
||||
padding: 24px 24px 24px 154px;
|
||||
font-size: 0.95em;
|
||||
|
|
@ -504,6 +593,10 @@ onUnmounted(() => {
|
|||
justify-content: center;
|
||||
}
|
||||
|
||||
> .memo {
|
||||
margin: 16px 16px 0 16px;
|
||||
}
|
||||
|
||||
> .description {
|
||||
padding: 16px;
|
||||
text-align: center;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,27 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router
|
|||
});
|
||||
}
|
||||
|
||||
async function editMemo(): Promise<void> {
|
||||
const userDetailed = await os.api('users/show', {
|
||||
userId: user.id,
|
||||
});
|
||||
const { canceled, result } = await os.form(i18n.ts.editMemo, {
|
||||
memo: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
multiline: true,
|
||||
label: i18n.ts.memo,
|
||||
default: userDetailed.memo,
|
||||
},
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
os.apiWithDialog('users/update-memo', {
|
||||
memo: result.memo,
|
||||
userId: user.id,
|
||||
});
|
||||
}
|
||||
|
||||
let menu = [{
|
||||
icon: 'ti ti-at',
|
||||
text: i18n.ts.copyUsername,
|
||||
|
|
@ -123,6 +144,12 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router
|
|||
os.post({ specified: user, initialText: `@${user.username} ` });
|
||||
},
|
||||
}, null, {
|
||||
icon: 'ti ti-pencil',
|
||||
text: i18n.ts.editMemo,
|
||||
action: () => {
|
||||
editMemo();
|
||||
},
|
||||
}, {
|
||||
type: 'parent',
|
||||
icon: 'ti ti-list',
|
||||
text: i18n.ts.addToList,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue