chore: 🎨 format

This commit is contained in:
ThatOneCalculator 2023-06-30 23:35:45 -07:00
parent 6fbe508403
commit ee5a08efdc
No known key found for this signature in database
GPG key ID: 8703CACD01000000
3 changed files with 59 additions and 37 deletions

View file

@ -382,12 +382,17 @@ async function expireOldFile(user: IRemoteUser, driveCapacity: number) {
} }
//This selete is hard coded, be careful if change database schema //This selete is hard coded, be careful if change database schema
q.addSelect('SUM("file"."size") OVER (ORDER BY "file"."id" DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)', 'acc_usage'); q.addSelect(
'SUM("file"."size") OVER (ORDER BY "file"."id" DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)',
"acc_usage",
);
q.orderBy("file.id", "ASC"); q.orderBy("file.id", "ASC");
const fileList = await q.getRawMany(); const fileList = await q.getRawMany();
const exceedFileIds = fileList.filter((x: any) => x.acc_usage > driveCapacity).map((x: any) => x.file_id); const exceedFileIds = fileList
.filter((x: any) => x.acc_usage > driveCapacity)
.map((x: any) => x.file_id);
for (const fileId of exceedFileIds) { for (const fileId of exceedFileIds) {
const file = await DriveFiles.findOneBy({ id: fileId }); const file = await DriveFiles.findOneBy({ id: fileId });
@ -536,7 +541,7 @@ export async function addFile({
// (アバターまたはバナーを含まず)最も古いファイルを削除する // (アバターまたはバナーを含まず)最も古いファイルを削除する
expireOldFile( expireOldFile(
(await Users.findOneByOrFail({ id: user.id })) as IRemoteUser, (await Users.findOneByOrFail({ id: user.id })) as IRemoteUser,
driveCapacity - info.size driveCapacity - info.size,
); );
} }
} }

View file

@ -224,7 +224,12 @@
</div> </div>
</article> </article>
</div> </div>
<button v-else class="muted _button" @click="muted.muted = false" @contextmenu.stop.prevent> <button
v-else
class="muted _button"
@click="muted.muted = false"
@contextmenu.stop.prevent
>
<I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small"> <I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small">
<template #name> <template #name>
<MkA <MkA
@ -332,7 +337,9 @@ let appearNote = $computed(() =>
const isMyRenote = $i && $i.id === note.userId; const isMyRenote = $i && $i.id === note.userId;
const showContent = ref(false); const showContent = ref(false);
const isDeleted = ref(false); const isDeleted = ref(false);
const muted = ref(getWordSoftMute(appearNote, $i, defaultStore.state.mutedWords)); const muted = ref(
getWordSoftMute(appearNote, $i, defaultStore.state.mutedWords)
);
const translation = ref(null); const translation = ref(null);
const translating = ref(false); const translating = ref(false);
const enableEmojiReactions = defaultStore.state.enableEmojiReactions; const enableEmojiReactions = defaultStore.state.enableEmojiReactions;

View file

@ -5,11 +5,7 @@
> >
<!-- v-if="!fetching" for now, I think there's something <!-- v-if="!fetching" for now, I think there's something
weird w/ some links stuck loading (?) --> weird w/ some links stuck loading (?) -->
<article <article v-if="!fetching" class="url-preview" @click.stop>
v-if="!fetching"
class="url-preview"
@click.stop
>
<component <component
:is="self ? 'MkA' : 'a'" :is="self ? 'MkA' : 'a'"
:[attr]="self ? url.substring(local.length) : url" :[attr]="self ? url.substring(local.length) : url"
@ -17,30 +13,37 @@
:target="target" :target="target"
:title="url" :title="url"
:class="{ :class="{
hasButton: tweetId || player.url hasButton: tweetId || player.url,
}" }"
> >
<div <div v-if="thumbnail" class="thumbnail">
v-if="thumbnail" <img :src="thumbnail" loading="lazy" />
class="thumbnail"
>
<img :src="thumbnail" loading="lazy"/>
<button <button
v-if="tweetId" v-if="tweetId"
class="_button" class="_button"
v-tooltip="tweetExpanded ? i18n.ts.close : i18n.ts.expandTweet" v-tooltip="
tweetExpanded ? i18n.ts.close : i18n.ts.expandTweet
"
@click.stop.prevent="tweetExpanded = !tweetExpanded" @click.stop.prevent="tweetExpanded = !tweetExpanded"
> >
<i v-if="!tweetExpanded" class="ph-twitter-logo ph-bold ph-lg"></i> <i
v-if="!tweetExpanded"
class="ph-twitter-logo ph-bold ph-lg"
></i>
<i v-else class="ph-x ph-bold ph-lg"></i> <i v-else class="ph-x ph-bold ph-lg"></i>
</button> </button>
<button <button
v-else-if="player.url" v-else-if="player.url"
class="_button" class="_button"
v-tooltip="playerEnabled ? i18n.ts.close : i18n.ts.enablePlayer" v-tooltip="
playerEnabled ? i18n.ts.close : i18n.ts.enablePlayer
"
@click.stop.prevent="playerEnabled = !playerEnabled" @click.stop.prevent="playerEnabled = !playerEnabled"
> >
<i v-if="!playerEnabled" class="ph-play ph-bold ph-lg"></i> <i
v-if="!playerEnabled"
class="ph-play ph-bold ph-lg"
></i>
<i v-else class="ph-x ph-bold ph-lg"></i> <i v-else class="ph-x ph-bold ph-lg"></i>
</button> </button>
</div> </div>
@ -68,7 +71,9 @@
? '&autoplay=1&auto_play=1' ? '&autoplay=1&auto_play=1'
: '?autoplay=1&auto_play=1') : '?autoplay=1&auto_play=1')
" "
:style="`aspect-ratio: ${((player.width || 1) / (player.height || 1))}`" :style="`aspect-ratio: ${
(player.width || 1) / (player.height || 1)
}`"
frameborder="0" frameborder="0"
allow="autoplay; encrypted-media" allow="autoplay; encrypted-media"
allowfullscreen allowfullscreen
@ -190,7 +195,7 @@ onUnmounted(() => {
overflow: hidden; overflow: hidden;
> a { > a {
display: flex; display: flex;
transition: background .2s; transition: background 0.2s;
> div:first-child:not(:last-child) { > div:first-child:not(:last-child) {
position: relative; position: relative;
width: 90px; width: 90px;
@ -204,22 +209,22 @@ onUnmounted(() => {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
transition: opacity .2s; transition: opacity 0.2s;
} }
button { button {
display: flex; display: flex;
width: 100%; width: 100%;
height: 100%; height: 100%;
i { i {
background: var(--bg); background: var(--bg);
padding: 14px; padding: 14px;
border-radius: var(--radius); border-radius: var(--radius);
transform: scale(.95); transform: scale(0.95);
opacity: 0; opacity: 0;
transition: transform .2s, opacity .2s, background .2s; transition: transform 0.2s, opacity 0.2s, background 0.2s;
} }
&:hover, &:focus { &:hover,
&:focus {
i { i {
background: var(--panelHighlight) !important; background: var(--panelHighlight) !important;
transform: scale(1.1) !important; transform: scale(1.1) !important;
@ -232,7 +237,8 @@ onUnmounted(() => {
width: 0; width: 0;
flex-grow: 1; flex-grow: 1;
} }
h1, p { h1,
p {
display: block; display: block;
margin: 0; margin: 0;
overflow: hidden; overflow: hidden;
@ -242,19 +248,19 @@ onUnmounted(() => {
h1 { h1 {
font-size: 1em; font-size: 1em;
white-space: nowrap; white-space: nowrap;
margin-bottom: .2em; margin-bottom: 0.2em;
} }
p { p {
margin-bottom: -.5em; margin-bottom: -0.5em;
> span { > span {
display: -webkit-inline-box; display: -webkit-inline-box;
font-size: .8em; font-size: 0.8em;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
overflow: hidden; overflow: hidden;
> span { > span {
font-weight: 600; font-weight: 600;
margin-right: .4em; margin-right: 0.4em;
} }
} }
} }
@ -264,18 +270,21 @@ onUnmounted(() => {
vertical-align: middle; vertical-align: middle;
border-radius: 4px; border-radius: 4px;
} }
&:hover, &:focus, &:focus-within { &:hover,
&:focus,
&:focus-within {
background: var(--panelHighlight); background: var(--panelHighlight);
h1 { h1 {
text-decoration: underline; text-decoration: underline;
} }
} }
} }
&:hover, &:focus-within { &:hover,
&:focus-within {
> .hasButton { > .hasButton {
> div:first-child { > div:first-child {
img { img {
opacity: .2; opacity: 0.2;
} }
button i { button i {
transform: none; transform: none;
@ -289,7 +298,8 @@ onUnmounted(() => {
display: block; display: block;
width: 100%; width: 100%;
overflow-y: auto; overflow-y: auto;
&:not([src^="https://platform.twitter"]) { &:not([src^="https://platform.twitter"])
{
max-height: 70vh; max-height: 70vh;
} }
} }