egirlskey/packages/frontend/src/components/MkUserOnlineIndicator.vue
Acid Chicken (硫酸鶏) 337dd97b49
perf(#10923): CSS Modules のクラス名をインライン化する (#10930)
* perf(#10923): unwind css module class name

* perf(#10923): support multiple components

* refactor: clean up

* refactor(#10923): avoid `useCssModule()`

* fix(#10923): allow direct literal class name

* fix(#10923): avoid computed class name

* fix(#10923): allow literal keys

* fix(#10923): typo

* fix(#10923): invalid class names

* chore: test

* revert: test

This reverts commit 5c7ef366eceebe8ba260efa4d5d675f6c1775c45.

* fix(#10923): hidden tale

* perf(#10923): also unwind scoped css contained components

* perf(#10923): `normalizeClass` AOT compilation

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-06-01 17:19:46 +09:00

54 lines
1.1 KiB
Vue

<template>
<div
v-tooltip="text"
:class="[$style.root, {
[$style.status_online]: user.onlineStatus === 'online',
[$style.status_active]: user.onlineStatus === 'active',
[$style.status_offline]: user.onlineStatus === 'offline',
[$style.status_unknown]: user.onlineStatus === 'unknown',
}]"
></div>
</template>
<script lang="ts" setup>
import { } from 'vue';
import * as misskey from 'misskey-js';
import { i18n } from '@/i18n';
const props = defineProps<{
user: misskey.entities.User;
}>();
const text = $computed(() => {
switch (props.user.onlineStatus) {
case 'online': return i18n.ts.online;
case 'active': return i18n.ts.active;
case 'offline': return i18n.ts.offline;
case 'unknown': return i18n.ts.unknown;
}
});
</script>
<style lang="scss" module>
.root {
box-shadow: 0 0 0 3px var(--panel);
border-radius: 120%; // Blinkのバグか知らんけど、100%ぴったりにすると何故か若干楕円でレンダリングされる
&.status_online {
background: #58d4c9;
}
&.status_active {
background: #e4bc48;
}
&.status_offline {
background: #ea5353;
}
&.status_unknown {
background: #888;
}
}
</style>