forked from sheepzh/time-tracker-4-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlert.tsx
More file actions
37 lines (32 loc) · 1.2 KB
/
Alert.tsx
File metadata and controls
37 lines (32 loc) · 1.2 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
import { getUrl } from "@api/chrome/runtime"
import { t } from "@cs/locale"
import { useRequest } from "@hooks/useRequest"
import Box from '@pages/components/Box'
import Flex from '@pages/components/Flex'
import optionHolder from "@service/components/option-holder"
import { defineComponent, type StyleValue } from "vue"
const ICON_URL = getUrl('static/images/icon.png')
const IMG_STYLE: StyleValue = {
width: '1.4em',
height: '1.4em',
marginInlineEnd: '.4em',
}
const _default = defineComponent(() => {
const defaultPrompt = t(msg => msg.modal.defaultPrompt)
const { data: prompt } = useRequest(async () => {
const option = await optionHolder.get()
return option?.limitPrompt || defaultPrompt
}, { defaultValue: defaultPrompt })
return () => (
<Flex marginBottom={80} column align='center'>
<Flex as='h2' align='center' lineHeight='2em'>
<img src={ICON_URL} style={IMG_STYLE} />
<span>{t(msg => msg.meta.name)?.toUpperCase()}</span>
</Flex>
<Box fontSize='2.7em' maxWidth='50vw' marginBlock='0.67em'>
{prompt.value}
</Box>
</Flex>
)
})
export default _default