mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
wip: refactor(client): migrate paging components to composition api
This commit is contained in:
parent
bb4589a1ef
commit
431054040f
3 changed files with 29 additions and 48 deletions
|
@ -21,35 +21,21 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import XPoll from './poll.vue';
|
||||
import XMediaList from './media-list.vue';
|
||||
import * as os from '@/os';
|
||||
import * as misskey from 'misskey-js';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
XPoll,
|
||||
XMediaList,
|
||||
},
|
||||
props: {
|
||||
note: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
collapsed: false,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.collapsed = this.note.cw == null && this.note.text && (
|
||||
(this.note.text.split('\n').length > 9) ||
|
||||
(this.note.text.length > 500)
|
||||
);
|
||||
}
|
||||
});
|
||||
const props = defineProps<{
|
||||
note: misskey.entities.Note;
|
||||
}>();
|
||||
|
||||
const collapsed = $ref(
|
||||
props.note.cw == null && props.note.text != null && (
|
||||
(props.note.text.split('\n').length > 9) ||
|
||||
(props.note.text.length > 500)
|
||||
));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -2,26 +2,21 @@
|
|||
<div v-tooltip="text" class="fzgwjkgc" :class="user.onlineStatus"></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
user: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
const props = defineProps<{
|
||||
user: misskey.entities.User;
|
||||
}>();
|
||||
|
||||
computed: {
|
||||
text(): string {
|
||||
switch (this.user.onlineStatus) {
|
||||
case 'online': return this.$ts.online;
|
||||
case 'active': return this.$ts.active;
|
||||
case 'offline': return this.$ts.offline;
|
||||
case 'unknown': return this.$ts.unknown;
|
||||
}
|
||||
}
|
||||
const text = $computed(() => {
|
||||
switch (props.user.onlineStatus) {
|
||||
case 'online': return i18n.locale.online;
|
||||
case 'active': return i18n.locale.active;
|
||||
case 'offline': return i18n.locale.offline;
|
||||
case 'unknown': return i18n.locale.unknown;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -84,19 +84,19 @@ export default defineComponent({
|
|||
prev: {
|
||||
endpoint: 'users/notes' as const,
|
||||
limit: 10,
|
||||
params: init => ({
|
||||
params: computed(() => ({
|
||||
userId: this.note.userId,
|
||||
untilId: this.note.id,
|
||||
})
|
||||
})),
|
||||
},
|
||||
next: {
|
||||
reversed: true,
|
||||
endpoint: 'users/notes' as const,
|
||||
limit: 10,
|
||||
params: init => ({
|
||||
params: computed(() => ({
|
||||
userId: this.note.userId,
|
||||
sinceId: this.note.id,
|
||||
})
|
||||
})),
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue