Skip to content

Commit

Permalink
💄
Browse files Browse the repository at this point in the history
  • Loading branch information
Squarecat-meow committed Sep 5, 2024
1 parent 9e84fa5 commit e21237d
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 17 deletions.
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5076,6 +5076,14 @@ export interface Locale extends ILocale {
* 修正履歴
*/
"editHistory": string;
/**
* 開く
*/
"fold": string;
/**
* 閉じる
*/
"unfold": string;
"_delivery": {
/**
* 配信状態
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,8 @@ createdLists: "作成したリスト"
createdAntennas: "作成したアンテナ"
noteUpdatedAt: "編集済み: {date} {time}"
editHistory: "修正履歴"
fold: "開く"
unfold: "閉じる"

_delivery:
status: "配信状態"
Expand Down
3 changes: 3 additions & 0 deletions locales/ko-KR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,9 @@ tryAgain: "다시 시도해 주세요."
confirmWhenRevealingSensitiveMedia: "민감한 미디어를 열 때 두 번 확인"
noteUpdatedAt: "편집됨: {date} {time}"
editHistory: "편집 기록"
fold: "펼치기"
unfold: "접기"

_delivery:
status: "전송 상태"
stop: "정지됨"
Expand Down
24 changes: 15 additions & 9 deletions packages/frontend/src/components/MkNoteHistorySub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<div :class="$style.main">
<div :class="$style.body">
<div :class="$style.noteHeader">
<MkAvatar :class="$style.noteHeaderAvatar" :user="originalNote.user" indicator link preview/>
<MkAvatar :class="$style.avatar" :user="originalNote.user" indicator link preview/>
<div>
<MkA v-user-preview="originalNote.user.id" :class="$style.name" :to="userPage(originalNote.user)">
<MkUserName :user="originalNote.user"/>
</MkA>
<div :class="$style.username">
<span><MkAcct :user="originalNote.user"/></span>
</div>
<div>
<span :class="$style.time">{{ i18n.ts.createdAt }}: <MkTime :time="history.createdAt" mode="detail"/>
</span>
</div>
Expand Down Expand Up @@ -49,7 +51,7 @@ const props = withDefaults(defineProps<{

<style lang="scss" module>
.root {
padding: 16px 32px;
padding: 12px 8px;
font-size: 0.9em;
position: relative;

Expand All @@ -61,11 +63,15 @@ const props = withDefaults(defineProps<{

.main {
display: flex;
padding: 16px;
border: dashed 1px var(--renote);
border-radius: 8px;
overflow: clip;
}
.name {
flex-shrink: 1;
display: block;
margin: 0 .5em 0 0.9em;
margin-left: 10px;
padding: 0;
overflow: hidden;
font-size: 1em;
Expand All @@ -79,8 +85,8 @@ const props = withDefaults(defineProps<{
}

.time {
margin-left: 1em;
font-size: 0.9em;
margin-left: 10px;
font-size: 0.8em;
color: var(--accent);
}

Expand All @@ -99,7 +105,7 @@ const props = withDefaults(defineProps<{
}
.username {
flex-shrink: 9999999;
margin: 0 .5em 0 0.9em;
margin-left: 10px;
overflow: hidden;
text-overflow: ellipsis;
}
Expand All @@ -117,9 +123,9 @@ const props = withDefaults(defineProps<{
.avatar {
flex-shrink: 0;
display: block;
margin: 0 8px 0 0;
width: 38px;
height: 38px;
margin-right: 4px;
width: 50px;
height: 50px;
border-radius: 8px;
}

Expand Down
18 changes: 10 additions & 8 deletions packages/frontend/src/components/MkNoteHistorySubContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<span v-if="props.history.files && props.history.files.length > 0 && !collapsed">
<MkMediaList :mediaList="props.history.files"/>
</span>
<button v-if="collapsed" :class="$style.showMore" class="_button" @click="collapsed = false">
<span :class="$style.showMoreLabel">{{ i18n.ts.showMore }}</span>
</button>
<button v-else-if="!collapsed" :class="$style.showLess" class="_button" @click="collapsed = true">
<span :class="$style.showLessLabel">{{ i18n.ts.showLess }}</span>
</button>
<div :class="$style.showButton">
<button v-if="collapsed" :class="$style.showMore" class="_button" @click="collapsed = false">
<span :class="$style.showMoreLabel">{{ i18n.ts.fold }}</span>
</button>
<button v-else-if="!collapsed" :class="$style.showLess" class="_button" @click="collapsed = true">
<span :class="$style.showLessLabel">{{ i18n.ts.unfold }}</span>
</button>
</div>
</div>
</template>

Expand Down Expand Up @@ -56,7 +58,7 @@ const collapsed = ref(true);
.showMoreLabel {
display: inline-block;
background: var(--popup);
padding: 0.6em 5em;
padding: 0.6em 8em;
font-size: 0.8em;
border-radius: 0.8em;
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
Expand All @@ -72,7 +74,7 @@ const collapsed = ref(true);
.showLessLabel {
display: inline-block;
background: var(--popup);
padding: 0.6em 5em;
padding: 0.6em 8em;
margin-top: 3em;
font-size: 0.8em;
border-radius: 0.8em;
Expand Down
32 changes: 32 additions & 0 deletions packages/frontend/src/scripts/get-note-history.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

import { i18n } from '@/i18n.js';
import { MenuItem } from '@/types/menu.js';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { misskeyApi } from './misskey-api.js';
import { NoteHistory } from 'misskey-js/entities.js';

export async function getNoteHistory(props: {
note: Misskey.entities.Note;
}) {
const cleanups = [] as (() => void)[];

const history:NoteHistory[] = await misskeyApi('notes/history', {noteId: props.note.id})

const menu: MenuItem[] = [{
text: history[0].updatedAt
}]

const cleanup = () => {
if (_DEV_) console.log('note menu cleanup', cleanups);
for (const cl of cleanups) {
cl();
}
};

return menu;
}

0 comments on commit e21237d

Please sign in to comment.