From 544e3a008e667039133ed3a9497f170c93a7af1a Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 28 May 2023 20:14:08 -0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20server=20info=20widget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Syuilo --- locales/en-US.yml | 23 ++-- .../backend/src/models/repositories/user.ts | 23 ++-- .../client/src/components/MkMediaImage.vue | 2 +- .../client/src/components/MkMediaList.vue | 13 +- .../client/src/components/MkMediaVideo.vue | 4 +- .../client/src/components/MkNoteDetailed.vue | 8 +- .../src/components/MkSubNoteContent.vue | 29 +++-- packages/client/src/pages/note.vue | 10 +- packages/client/src/widgets/index.ts | 5 + packages/client/src/widgets/server-info.vue | 114 ++++++++++++++++++ 10 files changed, 181 insertions(+), 50 deletions(-) create mode 100644 packages/client/src/widgets/server-info.vue diff --git a/locales/en-US.yml b/locales/en-US.yml index 84e68ea6b..57afc1766 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1526,28 +1526,29 @@ _weekday: friday: "Friday" saturday: "Saturday" _widgets: - memo: "Sticky notes" + memo: "Sticky Notes" notifications: "Notifications" timeline: "Timeline" calendar: "Calendar" trends: "Trending" clock: "Clock" - rss: "RSS reader" - rssTicker: "RSS-Ticker" + rss: "RSS Reader" + rssTicker: "RSS Ticker" activity: "Activity" photos: "Photos" - digitalClock: "Digital clock" - unixClock: "UNIX clock" + digitalClock: "Digital Clock" + unixClock: "UNIX Clock" federation: "Federation" - instanceCloud: "Server cloud" - postForm: "Posting form" + instanceCloud: "Server Cloud" + postForm: "Posting Form" slideshow: "Slideshow" button: "Button" - onlineUsers: "Online users" + onlineUsers: "Online Users" jobQueue: "Job Queue" - serverMetric: "Server metrics" - aiscript: "AiScript console" - userList: "User list" + serverMetric: "Server Metrics" + aiscript: "AiScript Console" + userList: "User List" + serverInfo: "Server Info" _userList: chooseList: "Select a list" _cw: diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index 5e0b83792..1ca9b3289 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -257,17 +257,22 @@ export const UserRepository = db.getRepository(User).extend({ async getHasUnreadAntenna(userId: User["id"]): Promise { try { - const myAntennas = (await getAntennas()).filter((a) => a.userId === userId); + const myAntennas = (await getAntennas()).filter( + (a) => a.userId === userId, + ); - const unread = - myAntennas.length > 0 - ? await AntennaNotes.findOneBy({ - antennaId: In(myAntennas.map((x) => x.id)), - read: false, - }) - : null; + const unread = + myAntennas.length > 0 + ? await AntennaNotes.findOneBy({ + antennaId: In(myAntennas.map((x) => x.id)), + read: false, + }) + : null; - return unread != null; } catch(e) { return false; } + return unread != null; + } catch (e) { + return false; + } }, async getHasUnreadChannel(userId: User["id"]): Promise { diff --git a/packages/client/src/components/MkMediaImage.vue b/packages/client/src/components/MkMediaImage.vue index 74f45c69c..9097a4771 100644 --- a/packages/client/src/components/MkMediaImage.vue +++ b/packages/client/src/components/MkMediaImage.vue @@ -91,7 +91,7 @@ watch( align-items: center; padding: 30px; box-sizing: border-box; - background: rgba(0,0,0,0.5); + background: rgba(0, 0, 0, 0.5); > .wrapper { display: table-cell; diff --git a/packages/client/src/components/MkMediaList.vue b/packages/client/src/components/MkMediaList.vue index 901aceeff..c01ccd5d8 100644 --- a/packages/client/src/components/MkMediaList.vue +++ b/packages/client/src/components/MkMediaList.vue @@ -11,10 +11,7 @@ :data-count="previewableCount < 5 ? previewableCount : null" :class="{ dmWidth: inDm }" > -
+