feat: spacing tokens, actionable failure copy, unified focus ring, 44px touch targets, press feedback
This commit is contained in:
@@ -5,6 +5,7 @@ import MemoRow, { type MemoListItem } from './components/MemoRow.vue'
|
||||
import MemoEditor, { type MemoEditorValue, type MemoRecord } from './components/MemoEditor.vue'
|
||||
import AppDialog, { type AppDialogOptions } from './components/AppDialog.vue'
|
||||
import AppSheet from './components/AppSheet.vue'
|
||||
import { failureHint } from './failureHint'
|
||||
|
||||
type RequestFn = (path: string, options?: RequestInit) => Promise<unknown>
|
||||
const props = defineProps<{ request: RequestFn }>()
|
||||
@@ -55,7 +56,7 @@ async function load(reset = true) {
|
||||
committedGeneration = token
|
||||
}
|
||||
} catch (reason) {
|
||||
if (token === generation && criteriaEqual(criteria, currentCriteria())) error.value = reason instanceof Error ? reason.message : '加载失败'
|
||||
if (token === generation && criteriaEqual(criteria, currentCriteria())) error.value = failureHint('加载失败', reason)
|
||||
} finally {
|
||||
if (token === generation && criteriaEqual(criteria, currentCriteria())) {
|
||||
loading.value = false
|
||||
@@ -76,7 +77,7 @@ async function loadMore() {
|
||||
items.value = [...items.value, ...data.items]
|
||||
total.value = data.total
|
||||
page.value = nextPage
|
||||
} catch (reason) { if (token === generation) error.value = reason instanceof Error ? reason.message : '加载失败' }
|
||||
} catch (reason) { if (token === generation) error.value = reason instanceof Error ? reason.message : failureHint('加载失败', reason) }
|
||||
finally { if (token === generation) refreshing.value = false }
|
||||
}
|
||||
function closeDetail() {
|
||||
@@ -108,7 +109,7 @@ async function selectMemo(id: string, opener?: EventTarget | null) {
|
||||
const memo = await props.request(`/memos/${id}`) as MemoRecord
|
||||
if (token === detailGeneration) { selectedToken.value = token; selected.value = memo; emit('detail', true) }
|
||||
} catch (reason) {
|
||||
if (token === detailGeneration) error.value = reason instanceof Error ? reason.message : '读取失败'
|
||||
if (token === detailGeneration) error.value = failureHint('读取失败', reason)
|
||||
}
|
||||
}
|
||||
async function createMemo() {
|
||||
|
||||
Reference in New Issue
Block a user