feat(client): add instance info widget

This commit is contained in:
syuilo 2023-01-09 20:35:36 +09:00
parent c179d6f735
commit d06f61f23f
5 changed files with 102 additions and 4 deletions

View File

@ -66,7 +66,6 @@ You should also include the user name that made the change.
- Server: delete outdated notes of antenna regularly to improve db performance @syuilo
- Server: improve activitypub deliver performance @syuilo
- Client: use tabler-icons instead of fontawesome to better design @syuilo
- Client: Add AiScript App widget
- Client: Add new gabber kick sounds (thanks for noizenecio)
- Client: Add link to user RSS feed in profile menu @ssmucny
- Client: Compress non-animated PNG files @saschanaz
@ -74,16 +73,18 @@ You should also include the user name that made the change.
- Client: enhance dashboard of control panel @syuilo
- Client: Vite is upgraded to v4 @syuilo, @tamaina
- Client: HMR is available while yarn dev @tamaina
- Client: Make widgets of universal/classic sync between devices @tamaina
- Client: Implement the button to subscribe push notification @tamaina
- Client: Implement the toggle to or not to close push notifications when notifications or messages are read @tamaina
- Client: Improve RSS widget @tamaina
- Client: show Unicode emoji tooltip with its name in MkReactionsViewer.reaction @saschanaz
- Client: OpenSearch support @SoniEx2 @chaoticryptidz
- Client: Support remote objects in search @SoniEx2
- Client: user activity page @syuilo
- Client: Make widgets of universal/classic sync between devices @tamaina
- Client: add user list widget @syuilo
- Client: Add AiScript App widget
- Client: add profile widget @syuilo
- Client: add instance info widget @syuilo
- Client: Improve RSS widget @tamaina
- Client: add heatmap of daily active users to about page @syuilo
- Client: introduce fluent emoji @syuilo
- Client: add new theme @syuilo

View File

@ -1336,6 +1336,7 @@ _weekday:
_widgets:
profile: "プロフィール"
instanceInfo: "インスタンス情報"
memo: "付箋"
notifications: "通知"
timeline: "タイムライン"

View File

@ -2,6 +2,7 @@ import { App, defineAsyncComponent } from 'vue';
export default function(app: App) {
app.component('MkwProfile', defineAsyncComponent(() => import('./profile.vue')));
app.component('MkwInstanceInfo', defineAsyncComponent(() => import('./instance-info.vue')));
app.component('MkwMemo', defineAsyncComponent(() => import('./memo.vue')));
app.component('MkwNotifications', defineAsyncComponent(() => import('./notifications.vue')));
app.component('MkwTimeline', defineAsyncComponent(() => import('./timeline.vue')));
@ -31,6 +32,7 @@ export default function(app: App) {
export const widgets = [
'profile',
'instanceInfo',
'memo',
'notifications',
'timeline',

View File

@ -0,0 +1,94 @@
<template>
<div class="_panel">
<div :class="$style.container" :style="{ backgroundImage: $instance.bannerUrl ? `url(${ $instance.bannerUrl })` : null }">
<div :class="$style.iconContainer">
<img :src="$instance.iconUrl ?? $instance.faviconUrl ?? '/favicon.ico'" alt="" :class="$style.icon"/>
</div>
<div :class="$style.bodyContainer">
<div :class="$style.body">
<MkA :class="$style.name" to="/about" behavior="window">{{ $instance.name }}</MkA>
<div :class="$style.host">{{ host }}</div>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted, onUnmounted, Ref, ref, watch } from 'vue';
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
import { GetFormResultType } from '@/scripts/form';
import { host } from '@/config';
const name = 'instanceInfo';
const widgetPropsDef = {
};
type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
// vueimporttype
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
const { widgetProps, configure } = useWidgetPropsManager(name,
widgetPropsDef,
props,
emit,
);
defineExpose<WidgetComponentExpose>({
name,
configure,
id: props.widget ? props.widget.id : null,
});
</script>
<style lang="scss" module>
.container {
position: relative;
background-size: cover;
background-position: center;
display: flex;
}
.iconContainer {
display: inline-block;
text-align: center;
padding: 16px;
}
.icon {
display: inline-block;
width: 60px;
height: 60px;
border-radius: 8px;
box-sizing: border-box;
border: solid 3px #fff;
}
.bodyContainer {
display: flex;
align-items: center;
min-width: 0;
padding: 0 16px 0 0;
}
.body {
text-overflow: ellipsis;
overflow: clip;
}
.name {
color: #fff;
filter: drop-shadow(0 0 4px #000);
font-weight: bold;
}
.host {
color: #fff;
filter: drop-shadow(0 0 4px #000);
}
</style>

View File

@ -6,7 +6,7 @@
</div>
<div :class="$style.bodyContainer">
<div :class="$style.body">
<MkA v-once :class="$style.name" :to="userPage($i)">
<MkA :class="$style.name" :to="userPage($i)">
<MkUserName :user="$i"/>
</MkA>
<div :class="$style.username"><MkAcct :user="$i" detail/></div>