mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-23 07:15:11 +00:00
wip: refactor(client): migrate paging components to composition api
This commit is contained in:
parent
2900f998b1
commit
bd1f741dad
4 changed files with 55 additions and 108 deletions
|
@ -8,47 +8,32 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
import MkUserInfo from '@/components/user-info.vue';
|
import MkUserInfo from '@/components/user-info.vue';
|
||||||
import MkPagination from '@/components/ui/pagination.vue';
|
import MkPagination from '@/components/ui/pagination.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
user: misskey.entities.User;
|
||||||
MkPagination,
|
type: 'following' | 'followers';
|
||||||
MkUserInfo,
|
}>();
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
const followingPagination = {
|
||||||
user: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
followingPagination: {
|
|
||||||
endpoint: 'users/following' as const,
|
endpoint: 'users/following' as const,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
params: computed(() => ({
|
params: computed(() => ({
|
||||||
userId: this.user.id,
|
userId: props.user.id,
|
||||||
})),
|
})),
|
||||||
},
|
};
|
||||||
followersPagination: {
|
|
||||||
|
const followersPagination = {
|
||||||
endpoint: 'users/followers' as const,
|
endpoint: 'users/followers' as const,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
params: computed(() => ({
|
params: computed(() => ({
|
||||||
userId: this.user.id,
|
userId: props.user.id,
|
||||||
})),
|
})),
|
||||||
},
|
};
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -8,27 +8,16 @@
|
||||||
</MkContainer>
|
</MkContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { } from 'vue';
|
||||||
import * as os from '@/os';
|
import * as misskey from 'misskey-js';
|
||||||
import MkContainer from '@/components/ui/container.vue';
|
import MkContainer from '@/components/ui/container.vue';
|
||||||
import MkChart from '@/components/chart.vue';
|
import MkChart from '@/components/chart.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = withDefaults(defineProps<{
|
||||||
components: {
|
user: misskey.entities.User;
|
||||||
MkContainer,
|
limit?: number;
|
||||||
MkChart,
|
}>(), {
|
||||||
},
|
limit: 40,
|
||||||
props: {
|
|
||||||
user: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
limit: {
|
|
||||||
type: Number,
|
|
||||||
required: false,
|
|
||||||
default: 40
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,36 +6,23 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
import MkPagePreview from '@/components/page-preview.vue';
|
import MkPagePreview from '@/components/page-preview.vue';
|
||||||
import MkPagination from '@/components/ui/pagination.vue';
|
import MkPagination from '@/components/ui/pagination.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
user: misskey.entities.User;
|
||||||
MkPagination,
|
}>();
|
||||||
MkPagePreview,
|
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
const pagination = {
|
||||||
user: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
pagination: {
|
|
||||||
endpoint: 'users/pages' as const,
|
endpoint: 'users/pages' as const,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
params: computed(() => ({
|
params: computed(() => ({
|
||||||
userId: this.user.id,
|
userId: props.user.id,
|
||||||
})),
|
})),
|
||||||
},
|
};
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -13,38 +13,24 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
import MkPagination from '@/components/ui/pagination.vue';
|
import MkPagination from '@/components/ui/pagination.vue';
|
||||||
import MkNote from '@/components/note.vue';
|
import MkNote from '@/components/note.vue';
|
||||||
import MkReactionIcon from '@/components/reaction-icon.vue';
|
import MkReactionIcon from '@/components/reaction-icon.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
user: misskey.entities.User;
|
||||||
MkPagination,
|
}>();
|
||||||
MkNote,
|
|
||||||
MkReactionIcon,
|
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
const pagination = {
|
||||||
user: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
pagination: {
|
|
||||||
endpoint: 'users/reactions' as const,
|
endpoint: 'users/reactions' as const,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
params: computed(() => ({
|
params: computed(() => ({
|
||||||
userId: this.user.id,
|
userId: props.user.id,
|
||||||
})),
|
})),
|
||||||
},
|
};
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in a new issue