import Taro from '@tarojs/taro' import { Text, View } from '@tarojs/components' import Button from '@taroify/core/button' import '@taroify/core/button/style' import type { PracticeRecord } from '../services/practice' import { duration } from '../utils/dates' export { Button } export function PageHeading({ title, subtitle }: { title: string; subtitle: string }) { return BALLET ISLAND{title}{subtitle} } export function LoadState({ loading, error, retry }: { loading: boolean; error: string; retry: () => unknown }) { if (!loading && !error) return null return {loading ? '正在读取你的练习…' : error}{error && } } export function Empty({ title, text }: { title: string; text: string }) { return {title}{text} } export function RecordCards({ records }: { records: PracticeRecord[] }) { return {records.map(record => {record.projectName}{duration(record.minutes)} {record.date}{record.archived ? ' · 已归档项目' : ''} {record.note && {record.note}} )} } /** Return to the actual originating page; deep-entry forms fall back to records. */ export async function returnToSource(message?: string) { if (Taro.getCurrentPages().length > 1) await Taro.navigateBack() else await Taro.switchTab({ url: '/pages/index/index' }) if (message) void Taro.showToast({ title: message, icon: 'none' }) }