forked from sheepzh/time-tracker-4-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLayout.tsx
More file actions
50 lines (46 loc) · 1.53 KB
/
Layout.tsx
File metadata and controls
50 lines (46 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { useRequest } from "@hooks"
import Flex from '@pages/components/Flex'
import { selectSite } from "@service/stat-service"
import { formatTime } from "@util/time"
import { ElText } from "element-plus"
import { defineComponent, ref, type StyleValue } from "vue"
import RowList from "./components/RowList"
import Search from "./components/Search"
import { t } from "./locale"
const _default = defineComponent<{}>(() => {
const date = ref(new Date())
const query = ref('')
const { data, refresh, loading } = useRequest(() => selectSite({
date: date.value ?? new Date(),
query: query.value,
sortKey: 'focus',
sortDirection: 'DESC',
}))
return () => <Flex column height='100%'>
<Search
defaultQuery={query.value}
defaultDate={date.value}
onSearch={(newQuery, newDate) => {
query.value = newQuery
date.value = newDate
// Force refresh
refresh()
}}
/>
<Flex height={60} style={{ paddingInlineStart: '5px' }}>
<ElText>
{t(msg => msg.list.title)}
</ElText>
 
<ElText size="small">
@{formatTime(date.value, t(msg => msg.calendar.dateFormat))}
</ElText>
</Flex>
<RowList
loading={loading.value}
data={data.value ?? []}
style={{ flex: 1, overflow: "auto" } satisfies StyleValue}
/>
</Flex>
})
export default _default