@chem-po/react-web 0.0.51 → 0.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/package.json +4 -5
  2. package/src/components/auth/SignIn.tsx +0 -43
  3. package/src/components/auth/index.ts +0 -1
  4. package/src/components/box/CollapseHorizontal.tsx +0 -19
  5. package/src/components/box/ContentBox.tsx +0 -17
  6. package/src/components/box/ExpandOnMount.tsx +0 -48
  7. package/src/components/box/Expandable.tsx +0 -96
  8. package/src/components/box/FullSizeContainer.tsx +0 -50
  9. package/src/components/box/MobileFrame/index.tsx +0 -146
  10. package/src/components/box/MobileFrame/styles.css +0 -35
  11. package/src/components/box/index.ts +0 -6
  12. package/src/components/button/DeleteButton.tsx +0 -178
  13. package/src/components/button/Toggle.tsx +0 -88
  14. package/src/components/button/ViewButton.tsx +0 -30
  15. package/src/components/button/index.ts +0 -3
  16. package/src/components/feed/FeedContentPane.tsx +0 -111
  17. package/src/components/feed/MediaFeed.tsx +0 -200
  18. package/src/components/feed/MediaFeedBackground.tsx +0 -127
  19. package/src/components/feed/MediaFeedRefresh.tsx +0 -78
  20. package/src/components/feed/MediaFeedSwipeUp.tsx +0 -35
  21. package/src/components/feed/constants.ts +0 -11
  22. package/src/components/feed/context.tsx +0 -19
  23. package/src/components/feed/hooks.ts +0 -290
  24. package/src/components/feed/index.ts +0 -2
  25. package/src/components/feed/types.ts +0 -50
  26. package/src/components/form/Condition.tsx +0 -26
  27. package/src/components/form/Field.tsx +0 -39
  28. package/src/components/form/Form.tsx +0 -428
  29. package/src/components/form/FormFooter.tsx +0 -90
  30. package/src/components/form/UploadProgress/index.tsx +0 -38
  31. package/src/components/form/UploadProgress/styles.css +0 -23
  32. package/src/components/form/index.ts +0 -4
  33. package/src/components/form/input/Editable.tsx +0 -155
  34. package/src/components/form/input/InputSlider.tsx +0 -76
  35. package/src/components/form/input/OptionalTag.tsx +0 -33
  36. package/src/components/form/input/StandaloneInput.tsx +0 -41
  37. package/src/components/form/input/boolean/index.tsx +0 -53
  38. package/src/components/form/input/color/index.tsx +0 -126
  39. package/src/components/form/input/date/index.tsx +0 -122
  40. package/src/components/form/input/datetime/index.tsx +0 -93
  41. package/src/components/form/input/file.tsx +0 -379
  42. package/src/components/form/input/hooks/index.ts +0 -2
  43. package/src/components/form/input/hooks/useInputImperativeHandle.ts +0 -16
  44. package/src/components/form/input/hooks/useInputStyles.ts +0 -125
  45. package/src/components/form/input/index.ts +0 -2
  46. package/src/components/form/input/input.css +0 -44
  47. package/src/components/form/input/input.tsx +0 -134
  48. package/src/components/form/input/multipleSelect/index.tsx +0 -89
  49. package/src/components/form/input/number/index.tsx +0 -87
  50. package/src/components/form/input/number/styles.css +0 -8
  51. package/src/components/form/input/select/index.tsx +0 -109
  52. package/src/components/form/input/shared/InputContainer.tsx +0 -13
  53. package/src/components/form/input/socialMedia/index.tsx +0 -165
  54. package/src/components/form/input/text/index.tsx +0 -78
  55. package/src/components/form/input/text/textarea.tsx +0 -43
  56. package/src/components/form/input/time/index.tsx +0 -33
  57. package/src/components/form/input/type.ts +0 -0
  58. package/src/components/form/input/types.ts +0 -4
  59. package/src/components/form/view/file.tsx +0 -36
  60. package/src/components/form/view/index.tsx +0 -52
  61. package/src/components/form/view/multipleSelect.tsx +0 -51
  62. package/src/components/form/view/select.tsx +0 -50
  63. package/src/components/form/view/types.ts +0 -11
  64. package/src/components/index.ts +0 -14
  65. package/src/components/list/Body/InfiniteScrollGridBody.tsx +0 -177
  66. package/src/components/list/Body/InfiniteScrollListBody.tsx +0 -114
  67. package/src/components/list/Body/ListBody.tsx +0 -24
  68. package/src/components/list/Body/PagedGridBody.tsx +0 -104
  69. package/src/components/list/Body/PagedListBody.tsx +0 -92
  70. package/src/components/list/Body/hooks.ts +0 -84
  71. package/src/components/list/DataList.tsx +0 -33
  72. package/src/components/list/ListContainer.tsx +0 -21
  73. package/src/components/list/ListContent.tsx +0 -54
  74. package/src/components/list/ListCreate.tsx +0 -57
  75. package/src/components/list/ListFilters.tsx +0 -182
  76. package/src/components/list/ListFooter.tsx +0 -458
  77. package/src/components/list/ListHeader.tsx +0 -180
  78. package/src/components/list/ListItem/ListCell.tsx +0 -49
  79. package/src/components/list/ListItem/ListRow.tsx +0 -44
  80. package/src/components/list/ListItemView.tsx +0 -53
  81. package/src/components/list/ListSort.tsx +0 -84
  82. package/src/components/list/NoItems.tsx +0 -33
  83. package/src/components/list/constants.ts +0 -1
  84. package/src/components/list/index.ts +0 -4
  85. package/src/components/list/types.ts +0 -26
  86. package/src/components/list/utils.ts +0 -63
  87. package/src/components/loading/CircularProgress.tsx +0 -12
  88. package/src/components/loading/Loading.tsx +0 -160
  89. package/src/components/loading/LoadingImage.tsx +0 -128
  90. package/src/components/loading/LoadingSwitch.tsx +0 -78
  91. package/src/components/loading/index.ts +0 -4
  92. package/src/components/media/PlayButton.tsx +0 -95
  93. package/src/components/media/index.ts +0 -1
  94. package/src/components/modal/DefaultModal.tsx +0 -18
  95. package/src/components/modal/DesktopModal.tsx +0 -16
  96. package/src/components/modal/ForceMobile.tsx +0 -7
  97. package/src/components/modal/MobileModal.tsx +0 -89
  98. package/src/components/modal/index.ts +0 -3
  99. package/src/components/modal/type.ts +0 -7
  100. package/src/components/nav/NavBar.tsx +0 -102
  101. package/src/components/nav/index.ts +0 -1
  102. package/src/components/overlay/ImageViewOverlay.tsx +0 -88
  103. package/src/components/overlay/MobileOverlay.tsx +0 -23
  104. package/src/components/overlay/index.ts +0 -2
  105. package/src/components/text/GradientText/index.tsx +0 -17
  106. package/src/components/text/GradientText/styles.css +0 -5
  107. package/src/components/text/NumberTicker.tsx +0 -28
  108. package/src/components/text/index.ts +0 -1
  109. package/src/components/theme/colorMode/DarkModeToggle.tsx +0 -40
  110. package/src/components/theme/colorMode/index.ts +0 -1
  111. package/src/components/theme/index.ts +0 -1
  112. package/src/components/view/ErrorView.tsx +0 -14
  113. package/src/components/view/RedirectView.tsx +0 -43
  114. package/src/components/view/index.ts +0 -2
  115. package/src/contexts/index.ts +0 -2
  116. package/src/contexts/theme.ts +0 -316
  117. package/src/contexts/view.tsx +0 -26
  118. package/src/custom.d.ts +0 -4
  119. package/src/hooks/index.ts +0 -1
  120. package/src/hooks/ui/index.ts +0 -1
  121. package/src/hooks/ui/useBorderColor.ts +0 -4
  122. package/src/index.ts +0 -5
  123. package/src/store/index.ts +0 -1
  124. package/src/store/usePlayer.ts +0 -75
  125. package/src/store/useScreen.ts +0 -22
  126. package/src/types/forms.ts +0 -5
  127. package/src/types/index.ts +0 -1
@@ -1,4 +0,0 @@
1
- export * from './CircularProgress'
2
- export * from './Loading'
3
- export * from './LoadingImage'
4
- export * from './LoadingSwitch'
@@ -1,95 +0,0 @@
1
- import { ButtonProps, Center, IconButton, Image } from '@chakra-ui/react'
2
- import { SpotifyTrack, WithId } from '@chem-po/core'
3
- import { usePlaylist } from '@chem-po/react'
4
- import React from 'react'
5
- import { useActiveMedia, usePlayer } from '../../store/usePlayer'
6
-
7
- export const PlayButton = ({
8
- media,
9
- size = 50,
10
- opacity = 0.8,
11
- // withThumbnail,
12
- buttonProps,
13
- }: {
14
- media: WithId<SpotifyTrack> | null
15
- size?: number
16
- opacity?: number
17
- withThumbnail?: boolean
18
- buttonProps?: ButtonProps
19
- }) => {
20
- const { id: mediaId } = media ?? {}
21
- const { playlist } = usePlaylist()
22
- const api = usePlayer(s => s.api)
23
- const playerIsPlaying = usePlayer(s => s.isPlaying)
24
- const playerIsLoading = usePlayer(s => s.isLoading)
25
- const currentMedia = useActiveMedia()
26
- const isPlaying = playerIsPlaying && currentMedia?.id === mediaId
27
- const isFetching = playerIsLoading && currentMedia?.id === mediaId
28
-
29
- return (
30
- <IconButton
31
- boxShadow="md"
32
- p={1}
33
- height={`${size}px`}
34
- width={`${size}px`}
35
- minW="0"
36
- minH="0"
37
- borderRadius="full"
38
- isLoading={isFetching}
39
- aria-label="play/pause"
40
- onClick={e => {
41
- e.stopPropagation()
42
- if (!media) return
43
- if (currentMedia?.id === mediaId) {
44
- if (playerIsPlaying) api.pause()
45
- else api.play()
46
- } else if (playlist) {
47
- api.setMedia({
48
- playlist: {
49
- ...playlist,
50
- currentId: mediaId ?? null,
51
- },
52
- })
53
- } else {
54
- api.setMedia({ media })
55
- }
56
- }}
57
- style={{ background: '#eee' }}
58
- {...buttonProps}
59
- icon={
60
- <Center borderRadius="full" height={`${size}px`} width={`${size}px`}>
61
- {/* {
62
- media ? (
63
- <StorageImage
64
- borderRadius='full'
65
- position='absolute'
66
- objectFit='cover'
67
- width='100%'
68
- height='100%'
69
- storagePath={`${media.storageDir}/photoFile`}
70
- alt={media.title}
71
- />
72
- ) : null
73
- } */}
74
- <Image
75
- opacity={isPlaying ? opacity : 0}
76
- width="100%"
77
- transition="all 0.2s ease-in-out"
78
- src="/svg/pause.svg"
79
- filter="invert(100%) drop-shadow(0 0 4px black)"
80
- transform={`scale(${isPlaying ? 0.8 : 1})`}
81
- />
82
- <Image
83
- position="absolute"
84
- width="100%"
85
- opacity={isPlaying ? 0 : opacity}
86
- transition="all 0.2s ease-in-out"
87
- filter="invert(100%) drop-shadow(0 0 3px black)"
88
- src="/svg/play.svg"
89
- transform={`scale(${!isPlaying ? 0.8 : 1})`}
90
- />
91
- </Center>
92
- }
93
- />
94
- )
95
- }
@@ -1 +0,0 @@
1
- export * from './PlayButton'
@@ -1,18 +0,0 @@
1
- import { useScreen } from '@chem-po/react'
2
- import React, { useMemo } from 'react'
3
- import { DesktopModal } from './DesktopModal'
4
- import { useForceMobile } from './ForceMobile'
5
- import { MobileModal } from './MobileModal'
6
- import { DefaultModalProps } from './type'
7
-
8
- export const DefaultModal = (props: DefaultModalProps) => {
9
- const isMobile = useScreen(s => s.isMobile)
10
-
11
- const forceMobile = useForceMobile()
12
- const Component = useMemo(
13
- () => (isMobile || forceMobile ? MobileModal : DesktopModal),
14
- [isMobile, forceMobile],
15
- )
16
-
17
- return <Component {...props} />
18
- }
@@ -1,16 +0,0 @@
1
- import { Box, Modal, ModalContent, ModalOverlay } from '@chakra-ui/react'
2
- import { useBackgroundColor } from '@chem-po/react'
3
- import React from 'react'
4
- import { DefaultModalProps } from './type'
5
-
6
- export const DesktopModal = ({ children, isOpen, contentProps, ...props }: DefaultModalProps) => {
7
- const bg = useBackgroundColor(100)
8
- return (
9
- <Modal scrollBehavior="inside" isCentered isOpen={isOpen} {...props}>
10
- <ModalOverlay />
11
- <ModalContent position="relative" overflowY="auto" bg={bg} {...contentProps}>
12
- <Box>{children}</Box>
13
- </ModalContent>
14
- </Modal>
15
- )
16
- }
@@ -1,7 +0,0 @@
1
- import React, { PropsWithChildren, useContext } from 'react'
2
-
3
- const ForceMobileContext = React.createContext(false)
4
- export const ForceMobile = ({ children }: PropsWithChildren) => (
5
- <ForceMobileContext.Provider value={true}>{children}</ForceMobileContext.Provider>
6
- )
7
- export const useForceMobile = () => useContext(ForceMobileContext)
@@ -1,89 +0,0 @@
1
- import { Flex, useColorModeValue } from '@chakra-ui/react'
2
- import { useMobileFrame } from '@chem-po/react'
3
- import React, { useEffect, useRef, useState } from 'react'
4
- import { MobileOverlay } from '../overlay/MobileOverlay'
5
- import { DefaultModalProps } from './type'
6
-
7
- export const MobileOverlayBackground = ({ onClick }: { onClick?: () => void }) => (
8
- <Flex
9
- onClick={onClick}
10
- w="100%"
11
- h="100%"
12
- position="absolute"
13
- bg="blackAlpha.400"
14
- transition="opacity 300ms"
15
- />
16
- )
17
-
18
- export const MobileModal = ({
19
- isOpen,
20
- onClose,
21
- children,
22
- contentProps,
23
- onContentMounted,
24
- closeOnOverlayClick,
25
- }: DefaultModalProps) => {
26
- const { height, width } = useMobileFrame()
27
-
28
- const bg = useColorModeValue('gray.100', '#454545')
29
-
30
- const [isMounted, setIsMounted] = useState(false)
31
- const [contentMounted, setContentMounted] = useState(false)
32
-
33
- const unmountTimeout = useRef<ReturnType<typeof setTimeout> | null>(null)
34
- const contentMountTimeout = useRef<ReturnType<typeof setTimeout> | null>(null)
35
- useEffect(() => {
36
- if (unmountTimeout.current) {
37
- clearTimeout(unmountTimeout.current)
38
- unmountTimeout.current = null
39
- }
40
-
41
- if (contentMountTimeout.current) {
42
- clearTimeout(contentMountTimeout.current)
43
- contentMountTimeout.current = null
44
- }
45
-
46
- if (isOpen) {
47
- setIsMounted(true)
48
- contentMountTimeout.current = setTimeout(() => {
49
- setContentMounted(true)
50
- if (onContentMounted) onContentMounted(true)
51
- }, 50)
52
- } else {
53
- setContentMounted(false)
54
- if (onContentMounted) onContentMounted(false)
55
- unmountTimeout.current = setTimeout(() => {
56
- setIsMounted(false)
57
- }, 300)
58
- }
59
- return () => {
60
- if (unmountTimeout.current) {
61
- clearTimeout(unmountTimeout.current)
62
- unmountTimeout.current = null
63
- }
64
- if (contentMountTimeout.current) {
65
- clearTimeout(contentMountTimeout.current)
66
- contentMountTimeout.current = null
67
- }
68
- }
69
- }, [isOpen, onContentMounted])
70
- return isMounted ? (
71
- <MobileOverlay
72
- opacity={contentMounted ? 1 : 0}
73
- pointerEvents={contentMounted ? 'auto' : 'none'}>
74
- <MobileOverlayBackground onClick={closeOnOverlayClick !== false ? onClose : undefined} />
75
- <Flex
76
- width={`${width - 10}px`}
77
- maxH={`${height - 10}px`}
78
- overflowY="auto"
79
- overflowX="hidden"
80
- minH="100px"
81
- bg={bg}
82
- borderRadius={6}
83
- position="relative"
84
- {...contentProps}>
85
- {children}
86
- </Flex>
87
- </MobileOverlay>
88
- ) : null
89
- }
@@ -1,3 +0,0 @@
1
- export * from './DefaultModal'
2
- export * from './DesktopModal'
3
- export * from './MobileModal'
@@ -1,7 +0,0 @@
1
- import { ModalContentProps, ModalProps } from '@chakra-ui/react'
2
- import { PropsWithChildren } from 'react'
3
-
4
- export type DefaultModalProps = PropsWithChildren<Omit<ModalProps, 'render'>> & {
5
- contentProps?: ModalContentProps
6
- onContentMounted?: (mounted: boolean) => void
7
- }
@@ -1,102 +0,0 @@
1
- import { Button, Flex, Image, useColorModeValue } from '@chakra-ui/react'
2
- import { palette } from '@chem-po/core'
3
- import { View } from '@chem-po/react'
4
- import React, { PropsWithChildren, useMemo } from 'react'
5
- import { Link, useLocation } from 'react-router-dom'
6
- import { useViews } from '../../contexts/view'
7
-
8
- export const NAV_BAR_HEIGHT = 50
9
-
10
- const NavBarLink = ({ view, absolute }: { view: View; absolute: boolean }) => {
11
- const { path: paths, name, icon, iconScale } = view
12
- const path = Array.isArray(paths) ? paths[0] : paths
13
-
14
- // const hoverBg = useColorModeValue('#00000033', '#f7f7f777')
15
- // const textColor = useColorModeValue('#777', '#cdcdcd')
16
- const iconBrightness = useColorModeValue(1, 1.8)
17
- const usedBrightness = useMemo(
18
- () => (absolute ? 2.4 : iconBrightness),
19
- [absolute, iconBrightness],
20
- )
21
- const { pathname } = useLocation()
22
- const hoverBg = useColorModeValue('#ffffff33', '#00000033')
23
- const body = (
24
- <Button
25
- pointerEvents={pathname === path ? 'none' : 'auto'}
26
- opacity={pathname === path ? 1 : 0.7}
27
- width="100%"
28
- height="100%"
29
- borderRadius={0}
30
- flexFlow="column"
31
- _hover={{
32
- bg: hoverBg,
33
- }}
34
- variant="unstyled"
35
- display="flex"
36
- alignItems="center"
37
- justifyContent="center">
38
- <Image
39
- height={`${34 * (iconScale ?? 1)}px`}
40
- filter={`brightness(${usedBrightness})${
41
- absolute ? ' drop-shadow(1px 1px 3px #00000099 )' : ''
42
- }`}
43
- src={icon}
44
- alt={name}
45
- />
46
- {/* <Text color={textColor} lineHeight={1} fontWeight={400} fontSize='xs'>
47
- {name}
48
- </Text> */}
49
- </Button>
50
- )
51
- return pathname === path ? (
52
- <Flex key={path} flex={1} h="100%" justify="center">
53
- {body}
54
- </Flex>
55
- ) : (
56
- <Link
57
- key={path}
58
- style={{
59
- flex: 1,
60
- display: 'flex',
61
- height: '100%',
62
- justifyContent: 'center',
63
- }}
64
- to={path}>
65
- {body}
66
- </Link>
67
- )
68
- }
69
-
70
- export const NavBar = ({
71
- selectedView,
72
- children,
73
- }: PropsWithChildren<{ selectedView?: View | null }>) => {
74
- const bg = useColorModeValue('#dedede', palette.gray.dark)
75
- const defaultBorderColor = useColorModeValue('#00000022', '#ffffff33')
76
- const views = useViews()
77
- const menuViews = useMemo(() => views.filter(v => !!v.view.icon), [views])
78
- const isAbsolute = useMemo(() => !!selectedView?.navBar?.absolute, [selectedView])
79
- const background = useMemo(() => selectedView?.navBar?.backgroundColor ?? bg, [bg, selectedView])
80
- const borderColor = useMemo(() => {
81
- if (selectedView?.navBar?.borderColor) return !!selectedView?.navBar?.borderColor
82
- return isAbsolute ? '#ffffff33' : defaultBorderColor
83
- }, [defaultBorderColor, selectedView, isAbsolute])
84
- return (
85
- <Flex
86
- position="absolute"
87
- bottom={0}
88
- left={0}
89
- bg={background}
90
- w="100%"
91
- transition="all 500ms"
92
- h={`${NAV_BAR_HEIGHT}px`}
93
- borderTop={`1px solid ${borderColor}`}>
94
- <Flex position="relative" w="100%" justify="space-around" align="center">
95
- {menuViews.map(({ view }) => (
96
- <NavBarLink absolute={isAbsolute} key={view.name} view={view} />
97
- ))}
98
- {children}
99
- </Flex>
100
- </Flex>
101
- )
102
- }
@@ -1 +0,0 @@
1
- export * from './NavBar'
@@ -1,88 +0,0 @@
1
- import { CloseIcon } from '@chakra-ui/icons'
2
- import { Center, IconButton, Image, Modal, ModalContent, ModalOverlay } from '@chakra-ui/react'
3
- import { useScreen } from '@chem-po/react'
4
- import React, { SyntheticEvent, useCallback, useMemo, useState } from 'react'
5
- import { LoadingLogo } from '../loading/Loading'
6
-
7
- export const ImageViewOverlay = ({ src, onClose }: { src: string; onClose: () => void }) => {
8
- const [loading, setLoading] = useState(true)
9
- const screenWidth = useScreen(s => s.width)
10
- const screenHeight = useScreen(s => s.height)
11
- const [imageSize, setImageSize] = useState({ width: screenWidth / 2, height: screenHeight / 2 })
12
-
13
- const { height, width } = useMemo(() => {
14
- if (loading) return imageSize
15
- const ratio = imageSize.width / imageSize.height
16
- let h = Math.min(imageSize.height, screenHeight * 0.9)
17
- let w = h * ratio
18
- if (w > screenWidth * 0.9) {
19
- w = Math.min(imageSize.width, screenWidth * 0.9)
20
- h = w / ratio
21
- }
22
- return { height: h, width: w }
23
- }, [screenHeight, screenWidth, imageSize, loading])
24
-
25
- const onLoadStart = useCallback(() => setLoading(true), [])
26
- const onLoad = useCallback((e: SyntheticEvent<HTMLImageElement>) => {
27
- const { naturalWidth, naturalHeight } = e.currentTarget
28
- setImageSize({ width: naturalWidth, height: naturalHeight })
29
- setLoading(false)
30
- }, [])
31
- return (
32
- <Modal size="full" isOpen onClose={onClose}>
33
- <ModalOverlay bg="blackAlpha.700" />
34
- <ModalContent
35
- style={{ background: 'transparent' }}
36
- pointerEvents="none"
37
- width="100%"
38
- height="100%">
39
- <Center
40
- pointerEvents="none"
41
- position="fixed"
42
- p={[4, 6, 8]}
43
- top={0}
44
- left={0}
45
- right={0}
46
- bottom={0}
47
- zIndex={4}>
48
- <Center
49
- opacity={loading ? 0 : 1}
50
- transition="all 500ms"
51
- overflow="hidden"
52
- w={`${width}px`}
53
- height={`${height}px`}>
54
- <Image
55
- onLoadStart={onLoadStart}
56
- onLoad={onLoad}
57
- transition="opacity 300ms"
58
- height="100%"
59
- objectFit="contain"
60
- borderRadius={4}
61
- src={src}
62
- />
63
- </Center>
64
- <IconButton
65
- borderRadius="full"
66
- position="absolute"
67
- top={4}
68
- right={4}
69
- aria-label="close"
70
- icon={<CloseIcon />}
71
- onClick={onClose}
72
- />
73
- </Center>
74
- <Center
75
- position="absolute"
76
- top={0}
77
- left={0}
78
- right={0}
79
- bottom={0}
80
- pointerEvents="none"
81
- opacity={loading ? 1 : 0}
82
- transition="opacity 300ms">
83
- <LoadingLogo isLoading={loading} size={70} />
84
- </Center>
85
- </ModalContent>
86
- </Modal>
87
- )
88
- }
@@ -1,23 +0,0 @@
1
- import { Flex, FlexProps, Portal } from '@chakra-ui/react'
2
- import { useMobileFrame } from '@chem-po/react'
3
- import React from 'react'
4
-
5
- export const MobileOverlay = (props: FlexProps) => {
6
- const { overlayRef } = useMobileFrame()
7
-
8
- return (
9
- <Portal containerRef={overlayRef}>
10
- <Flex
11
- justify="center"
12
- align="center"
13
- transition="opacity 300ms"
14
- position="absolute"
15
- left={0}
16
- top={0}
17
- height="100%"
18
- width="100%"
19
- {...props}
20
- />
21
- </Portal>
22
- )
23
- }
@@ -1,2 +0,0 @@
1
- export * from './ImageViewOverlay'
2
- export * from './MobileOverlay'
@@ -1,17 +0,0 @@
1
- import { Box, BoxProps, Text, TextProps } from '@chakra-ui/react'
2
- import React from 'react'
3
- import './styles.css'
4
-
5
- export const GradientText = ({
6
- children,
7
- color,
8
- background,
9
- boxProps,
10
- ...props
11
- }: TextProps & { boxProps?: BoxProps }) => (
12
- <Box background={background} {...boxProps}>
13
- <Text cursor="default" className="gradient-text" background={color} {...props}>
14
- {children}
15
- </Text>
16
- </Box>
17
- )
@@ -1,5 +0,0 @@
1
- .gradient-text {
2
- background-clip: text !important;
3
- -webkit-background-clip: text !important;
4
- -webkit-text-fill-color: transparent !important;
5
- }
@@ -1,28 +0,0 @@
1
- import React, { useEffect, useRef } from 'react'
2
-
3
- export const NumberTicker = ({ value, duration = 30 }: { value: number; duration?: number }) => {
4
- const spanRef = useRef<HTMLSpanElement>(null)
5
- const helperValue = useRef(value)
6
- const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null)
7
- useEffect(() => {
8
- intervalRef.current = setInterval(() => {
9
- if (spanRef.current) {
10
- if (helperValue.current === value && intervalRef.current)
11
- return clearInterval(intervalRef.current)
12
- if (helperValue.current < value) {
13
- helperValue.current += 1
14
- spanRef.current.innerText = helperValue.current.toString()
15
- } else if (helperValue.current > value) {
16
- helperValue.current -= 1
17
- spanRef.current.innerText = helperValue.current.toString()
18
- }
19
- }
20
- return () => {}
21
- }, duration)
22
- return () => {
23
- if (intervalRef.current) clearInterval(intervalRef.current)
24
- }
25
- }, [value, duration])
26
-
27
- return <span ref={spanRef}>{value}</span>
28
- }
@@ -1 +0,0 @@
1
- export * from './NumberTicker'
@@ -1,40 +0,0 @@
1
- import { MoonIcon, SunIcon } from '@chakra-ui/icons'
2
- import { Flex, FlexProps, IconButton, useColorMode, useColorModeValue } from '@chakra-ui/react'
3
- import React from 'react'
4
- export const DarkModeToggle = () => {
5
- const { colorMode, toggleColorMode } = useColorMode()
6
- const bg = useColorModeValue('gray.200', 'whiteAlpha.200')
7
- const color = useColorModeValue('blackAlpha.700', 'whiteAlpha.800')
8
- const hoverBg = useColorModeValue('gray.300', 'whiteAlpha.300')
9
- const hoverColor = useColorModeValue('gray.800', 'whiteAlpha.800')
10
- return (
11
- <IconButton
12
- aria-label="Toggle dark mode"
13
- bg={bg}
14
- color={color}
15
- borderRadius="full"
16
- _hover={{
17
- bg: hoverBg,
18
- color: hoverColor,
19
- }}
20
- w={8}
21
- h={8}
22
- minW={0}
23
- icon={
24
- colorMode === 'light' ? (
25
- <SunIcon w={4} h={4} />
26
- ) : (
27
- <MoonIcon w={4} h={4} filter="drop-shadow(1px 1px 2px #000000aa)" />
28
- )
29
- }
30
- onClick={toggleColorMode}
31
- variant="ghost"
32
- />
33
- )
34
- }
35
-
36
- export const AbsoluteDarkModeToggle = (props: FlexProps) => (
37
- <Flex position="absolute" bottom={3} right={3} {...props}>
38
- <DarkModeToggle />
39
- </Flex>
40
- )
@@ -1 +0,0 @@
1
- export * from './DarkModeToggle'
@@ -1 +0,0 @@
1
- export * from './colorMode'
@@ -1,14 +0,0 @@
1
- import { Flex, Text, useColorModeValue } from '@chakra-ui/react'
2
- import React from 'react'
3
- import { ContentBox } from '../box/ContentBox'
4
-
5
- export const ErrorView = ({ message }: { message?: string }) => {
6
- const color = useColorModeValue('gray.600', 'gray.100')
7
- return (
8
- <Flex pt={4}>
9
- <ContentBox>
10
- <Text color={color}>{message ?? 'Sorry, something went wrong.'}</Text>
11
- </ContentBox>
12
- </Flex>
13
- )
14
- }
@@ -1,43 +0,0 @@
1
- import { Center, HStack, Text, VStack } from '@chakra-ui/react'
2
- import { useAuth } from '@chem-po/react'
3
- import React, { useEffect, useRef } from 'react'
4
- import { useNavigate } from 'react-router-dom'
5
- import { ContentBox } from '../box/ContentBox'
6
- import { CircularProgress } from '../loading/CircularProgress'
7
- import { Loading } from '../loading/Loading'
8
-
9
- export const RedirectView: React.FC<{ loading?: boolean }> = ({ loading }) => {
10
- const timer = useRef<ReturnType<typeof setTimeout> | null>(null)
11
- const authLoading = useAuth(s => s.signInLoading)
12
- const multiFactorLoading = useAuth(s => s.multiFactorLoading)
13
-
14
- const navigate = useNavigate()
15
- useEffect(() => {
16
- if (!loading && !authLoading) {
17
- timer.current = setTimeout(() => {
18
- navigate('/')
19
- }, 1500)
20
- }
21
- return () => {
22
- if (timer.current) clearTimeout(timer.current)
23
- }
24
- }, [loading, navigate, authLoading])
25
-
26
- return !loading && !authLoading ? (
27
- <Center minH="100%" w="100%">
28
- <ContentBox maxW="500px">
29
- <HStack spacing={3}>
30
- <CircularProgress size={6} />
31
- <VStack spacing={0} align="flex-start">
32
- <Text>404</Text>
33
- <Text fontSize="sm" opacity={0.7}>
34
- Page not found - redirecting to Home...
35
- </Text>
36
- </VStack>
37
- </HStack>
38
- </ContentBox>
39
- </Center>
40
- ) : (
41
- <Loading />
42
- )
43
- }
@@ -1,2 +0,0 @@
1
- export * from './ErrorView'
2
- export * from './RedirectView'
@@ -1,2 +0,0 @@
1
- export * from './theme'
2
- export * from './view'