Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions frontend/components/common/StPagination.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<template>
<nav class="flex items-center justify-center gap-3" :aria-label="label">
<StIconButton
icon="solar:alt-arrow-left-linear"
variant="soft"
color="neutral"
rounded="full"
:disabled="modelValue <= 1"
:aria-label="prevLabel"
@click="go(modelValue - 1)"
/>

<span class="min-w-[4.5rem] text-center text-st-sm font-bold text-st-muted">{{ modelValue }} / {{ totalPages }}</span>

<StIconButton
icon="solar:alt-arrow-right-linear"
variant="soft"
color="neutral"
rounded="full"
:disabled="modelValue >= totalPages"
:aria-label="nextLabel"
@click="go(modelValue + 1)"
/>
</nav>
</template>

<script setup lang="ts">
/**
* Prev / "page N of M" / Next, in the redesigned language. Replaces pilotui's `Pagination`
* on migrated screens, keeping its `v-model` + `change-page` contract so a caller only has
* to swap the import.
*
* App-local rather than in subturtle-ui on purpose: the design system defines no pagination
* component, so this is our composition of its tokens and not a library primitive. The
* second migrated screen that needs one is the moment to graduate it — the same call
* InlineNotice records.
*/
import { StIconButton } from 'subturtle-ui';

const props = withDefaults(
defineProps<{
modelValue?: number;
totalPages?: number;
/** Accessible name for the nav landmark and its two buttons. */
label?: string;
prevLabel?: string;
nextLabel?: string;
}>(),
{ modelValue: 1, totalPages: 1, label: 'Pagination', prevLabel: 'Previous page', nextLabel: 'Next page' }
);

const emit = defineEmits<{ 'update:modelValue': [number]; 'change-page': [number] }>();

function go(page: number) {
if (page < 1 || page > props.totalPages || page === props.modelValue) return;
emit('update:modelValue', page);
emit('change-page', page);
}
</script>
14 changes: 14 additions & 0 deletions frontend/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,20 @@
"free-sessions": "Free sessions",
"free-chats": "Free text chats",
"pick-first": "Pick a bundle to start."
},
"search-placeholder": "Search sessions",
"dialog-count": "{count} dialog | {count} dialogs",
"showing_count": "Showing {shown} of {total}",
"no-matches": "No sessions match those filters",
"no-matches-description": "Nothing on this page matches. Try a different search, or switch back to All.",
"pagination": "Session history pages",
"prev-page": "Previous page",
"next-page": "Next page",
"filter": {
"all": "All"
},
"locked": {
"row-title": "Transcript locked"
}
},
"profile": {
Expand Down
Loading