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