Skip to content

Commit

Permalink
Merge branch 'misskey-dev:develop' into i18n-dts
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih authored Sep 10, 2023
2 parents 35194b4 + c0838c4 commit eba45be
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 62 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@
- メニューのスイッチの動作を改善
- 絵文字ピッカーの検索の表示件数を100件に増加
- 投稿フォームのプレビューの表示状態を記憶するように
- ノート詳細ページ読み込み時のパフォーマンスを改善
- AiScriptからMisskeyサーバーAPIを呼び出す際の制限を撤廃
- Playで直接投稿フォームを埋め込めるように(`Ui:C:postForm`)
- Enhance: ユーザーメニューでスイッチでユーザーリストに追加・削除できるように
- Enhance: 自分が押したリアクションのデザインを改善
- Enhance: ノート検索にローカルのみ検索可能なオプションの追加
- Enhance: AiScriptで`LOCALE`として現在の設定言語を取得できるように
- Enhance: Renote自体を通報できるように
- Enhance: データセーバーモードの強化
- Enhance: Renoteを管理者権限で削除可能に
- `$[rainbow ]`記法が、動きのあるMFMが無効になっていても使用できるようになりました
- Playの操作を行うAPI TokenをAPIコンソールから発行できるように
- リアクションの表示サイズをより大きくできるように
- ノート詳細ページ読み込み時のパフォーマンスを改善
- タイムラインでリスト/アンテナ選択時のパフォーマンスを改善
- Fix: サーバー情報画面(`/instance-info/{domain}`)でブロックができないのを修正
- Fix: 未読のお知らせの「わかった」をクリック・タップしてもその場で「わかった」が消えない問題を修正
- Fix: iOSで画面を回転させるとテキストサイズが変わる問題を修正
Expand Down
2 changes: 1 addition & 1 deletion locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ export interface Locale {
"enableChartsForRemoteUser": string;
"enableChartsForFederatedInstances": string;
"showClipButtonInNoteFooter": string;
"largeNoteReactions": string;
"reactionsDisplaySize": string;
"noteIdOrUrl": string;
"video": string;
"videos": string;
Expand Down
2 changes: 1 addition & 1 deletion locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ retryAllQueuesConfirmText: "一時的にサーバーの負荷が増大するこ
enableChartsForRemoteUser: "リモートユーザーのチャートを生成"
enableChartsForFederatedInstances: "リモートサーバーのチャートを生成"
showClipButtonInNoteFooter: "ノートのアクションにクリップを追加"
largeNoteReactions: "ノートのリアクションを大きく表示"
reactionsDisplaySize: "リアクションの表示サイズ"
noteIdOrUrl: "ノートIDまたはURL"
video: "動画"
videos: "動画"
Expand Down
39 changes: 28 additions & 11 deletions packages/frontend/src/components/MkMediaImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,40 @@ SPDX-License-Identifier: AGPL-3.0-only

<template>
<div :class="hide ? $style.hidden : $style.visible" :style="darkMode ? '--c: rgb(255 255 255 / 2%);' : '--c: rgb(0 0 0 / 2%);'" @click="onclick">
<a
:class="$style.imageContainer"
:href="image.url"
:title="image.name"
<component
:is="disableImageLink ? 'div' : 'a'"
v-bind="disableImageLink ? {
title: image.name,
class: $style.imageContainer,
} : {
title: image.name,
class: $style.imageContainer,
href: image.url,
style: 'cursor: zoom-in;'
}"
>
<ImgWithBlurhash
:hash="image.blurhash"
:src="(defaultStore.state.enableDataSaverMode && hide) ? null : url"
:forceBlurhash="hide"
:cover="hide"
:cover="hide || cover"
:alt="image.comment || image.name"
:title="image.comment || image.name"
:width="image.properties.width"
:height="image.properties.height"
:style="hide ? 'filter: brightness(0.5);' : null"
/>
</a>
</component>
<template v-if="hide">
<div :class="$style.hiddenText">
<div :class="$style.hiddenTextWrapper">
<b v-if="image.isSensitive" style="display: block;"><i class="ti ti-eye-exclamation"></i> {{ i18n.ts.sensitive }}{{ defaultStore.state.enableDataSaverMode ? ` (${i18n.ts.image}${image.size ? ' ' + bytes(image.size) : ''})` : '' }}</b>
<b v-else style="display: block;"><i class="ti ti-photo"></i> {{ defaultStore.state.enableDataSaverMode && image.size ? bytes(image.size) : i18n.ts.image }}</b>
<span style="display: block;">{{ i18n.ts.clickToShow }}</span>
<span v-if="controls" style="display: block;">{{ i18n.ts.clickToShow }}</span>
</div>
</div>
</template>
<template v-else>
<template v-else-if="controls">
<div :class="$style.indicators">
<div v-if="['image/gif', 'image/apng'].includes(image.type)" :class="$style.indicator">GIF</div>
<div v-if="image.comment" :class="$style.indicator">ALT</div>
Expand All @@ -54,10 +61,17 @@ import { i18n } from '@/i18n';
import * as os from '@/os';
import { iAmModerator } from '@/account';

const props = defineProps<{
const props = withDefaults(defineProps<{
image: Misskey.entities.DriveFile;
raw?: boolean;
}>();
cover?: boolean;
disableImageLink?: boolean;
controls?: boolean;
}>(), {
cover: false,
disableImageLink: false,
controls: true,
});

let hide = $ref(true);
let darkMode: boolean = $ref(defaultStore.state.darkMode);
Expand All @@ -70,6 +84,9 @@ const url = $computed(() => (props.raw || defaultStore.state.loadRawImages)
);

function onclick() {
if (!props.controls) {
return;
}
if (hide) {
hide = false;
}
Expand Down Expand Up @@ -117,6 +134,7 @@ function showMenu(ev: MouseEvent) {
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}

.hide {
Expand Down Expand Up @@ -167,7 +185,6 @@ function showMenu(ev: MouseEvent) {

.imageContainer {
display: block;
cursor: zoom-in;
overflow: hidden;
width: 100%;
height: 100%;
Expand Down
43 changes: 22 additions & 21 deletions packages/frontend/src/components/MkPagePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only

<template>
<MkA :to="`/@${page.user.username}/pages/${page.name}`" class="vhpxefrj" tabindex="-1">
<div v-if="page.eyeCatchingImage" class="thumbnail" :style="`background-image: url('${page.eyeCatchingImage.thumbnailUrl}')`"></div>
<div v-if="page.eyeCatchingImage" class="thumbnail">
<MediaImage
:image="page.eyeCatchingImage"
:disableImageLink="true"
:controls="false"
:cover="true"
:class="$style.eyeCatchingImageRoot"
/>
</div>
<article>
<header>
<h1 :title="page.title">{{ page.title }}</h1>
Expand All @@ -23,12 +31,22 @@ SPDX-License-Identifier: AGPL-3.0-only
import { } from 'vue';
import * as Misskey from 'misskey-js';
import { userName } from '@/filters/user';
import MediaImage from '@/components/MkMediaImage.vue';

const props = defineProps<{
page: Misskey.entities.Page;
}>();
</script>

<style module>
.eyeCatchingImageRoot {
width: 100%;
height: 200px;
border-radius: var(--radius) var(--radius) 0 0;
overflow: hidden;
}
</style>

<style lang="scss" scoped>
.vhpxefrj {
display: block;
Expand All @@ -39,32 +57,15 @@ const props = defineProps<{
}

> .thumbnail {
width: 100%;
height: 200px;
background-position: center;
background-size: cover;
display: flex;
justify-content: center;
align-items: center;

> button {
font-size: 3.5em;
opacity: 0.7;

&:hover {
font-size: 4em;
opacity: 0.9;
}
}

& + article {
left: 100px;
width: calc(100% - 100px);
border-radius: 0 0 var(--radius) var(--radius);
}
}

> article {
background-color: var(--panel);
padding: 16px;
border-radius: var(--radius);

> header {
margin-bottom: 8px;
Expand Down
32 changes: 22 additions & 10 deletions packages/frontend/src/components/MkReactionsViewer.reaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
ref="buttonEl"
v-ripple="canToggle"
class="_button"
:class="[$style.root, { [$style.reacted]: note.myReaction == reaction, [$style.canToggle]: canToggle, [$style.large]: defaultStore.state.largeNoteReactions }]"
:class="[$style.root, { [$style.reacted]: note.myReaction == reaction, [$style.canToggle]: canToggle, [$style.small]: defaultStore.state.reactionsDisplaySize === 'small', [$style.large]: defaultStore.state.reactionsDisplaySize === 'large' }]"
@click="toggleReaction()"
>
<MkReactionIcon :class="$style.icon" :reaction="reaction" :emojiUrl="note.reactionEmojis[reaction.substring(1, reaction.length - 1)]"/>
Expand Down Expand Up @@ -115,10 +115,11 @@ useTooltip(buttonEl, async (showing) => {
<style lang="scss" module>
.root {
display: inline-block;
height: 32px;
height: 42px;
margin: 2px;
padding: 0 6px;
border-radius: 4px;
font-size: 1.5em;
border-radius: 6px;

&.canToggle {
background: var(--buttonBg);
Expand All @@ -132,14 +133,25 @@ useTooltip(buttonEl, async (showing) => {
cursor: default;
}

&.small {
height: 32px;
font-size: 1em;
border-radius: 4px;

> .count {
font-size: 0.9em;
line-height: 32px;
}
}

&.large {
height: 42px;
font-size: 1.5em;
border-radius: 6px;
height: 52px;
font-size: 2em;
border-radius: 8px;

> .count {
font-size: 0.7em;
line-height: 42px;
font-size: 0.6em;
line-height: 52px;
}
}

Expand All @@ -159,8 +171,8 @@ useTooltip(buttonEl, async (showing) => {
}

.count {
font-size: 0.9em;
line-height: 32px;
font-size: 0.7em;
line-height: 42px;
margin: 0 0 0 4px;
}
</style>
3 changes: 2 additions & 1 deletion packages/frontend/src/components/MkUrlPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<div v-else>
<component :is="self ? 'MkA' : 'a'" :class="[$style.link, { [$style.compact]: compact }]" :[attr]="self ? url.substring(local.length) : url" rel="nofollow noopener" :target="target" :title="url">
<div v-if="thumbnail" :class="$style.thumbnail" :style="`background-image: url('${thumbnail}')`">
<div v-if="thumbnail" :class="$style.thumbnail" :style="defaultStore.state.enableDataSaverMode ? '' : `background-image: url('${thumbnail}')`">
</div>
<article :class="$style.body">
<header :class="$style.header">
Expand Down Expand Up @@ -260,6 +260,7 @@ onUnmounted(() => {
height: 100%;
background-position: center;
background-size: cover;
background-color: var(--bg);
display: flex;
justify-content: center;
align-items: center;
Expand Down
12 changes: 8 additions & 4 deletions packages/frontend/src/components/page/page.image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@ SPDX-License-Identifier: AGPL-3.0-only

<template>
<div>
<ImgWithBlurhash v-if="image" style="max-width: 100%;" :hash="image.blurhash" :src="image.url" :alt="image.comment" :title="image.comment" :width="image.properties.width" :height="image.properties.height" :cover="false"/>
<MediaImage
v-if="image"
:image="image"
:disableImageLink="true"
/>
</div>
</template>

<script lang="ts" setup>
import { } from 'vue';
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import { ImageBlock } from './block.type';
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
import MediaImage from '@/components/MkMediaImage.vue';

const props = defineProps<{
block: ImageBlock,
page: Misskey.entities.Page,
}>();

const image = props.page.attachedFiles.find(x => x.id === props.block.fileId);
const image = ref<Misskey.entities.DriveFile>(props.page.attachedFiles.find(x => x.id === props.block.fileId));
</script>
2 changes: 1 addition & 1 deletion packages/frontend/src/components/page/page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<div :class="{ [$style.center]: page.alignCenter, [$style.serif]: page.font === 'serif' }">
<div :class="{ [$style.center]: page.alignCenter, [$style.serif]: page.font === 'serif' }" class="_gaps_s">
<XBlock v-for="child in page.content" :key="child.id" :page="page" :block="child" :h="2"/>
</div>
</template>
Expand Down
10 changes: 10 additions & 0 deletions packages/frontend/src/local-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ type Keys =
'message_drafts' |
'scratchpad' |
'debug' |
'userListsCache' |
'antennasCache' |
`miux:${string}` |
`ui:folder:${string}` |
`themes:${string}` |
Expand All @@ -41,4 +43,12 @@ export const miLocalStorage = {
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),
getItemAsJson: (key: Keys): any | undefined => {
const item = miLocalStorage.getItem(key);
if (item === null) {
return undefined;
}
return JSON.parse(item);
},
setItemAsJson: (key: Keys, value: any): void => window.localStorage.setItem(key, JSON.stringify(value)),
};
Loading

0 comments on commit eba45be

Please sign in to comment.