@homefile/components-v2 2.3.0 → 2.4.0
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.
- package/dist/assets/images/animations/index.d.ts +7 -0
- package/dist/assets/images/animations/index.js +7 -0
- package/dist/assets/images/animations/index.ts +15 -0
- package/dist/assets/images/animations/trees-cloudy.png +0 -0
- package/dist/assets/images/animations/trees-day-fall.png +0 -0
- package/dist/assets/images/animations/trees-day-summer.png +0 -0
- package/dist/assets/images/animations/trees-day-winter.png +0 -0
- package/dist/assets/images/animations/trees-evening.png +0 -0
- package/dist/assets/images/animations/trees-morning.png +0 -0
- package/dist/assets/images/animations/trees-night.png +0 -0
- package/dist/assets/images/chat-bubble.svg +8 -0
- package/dist/assets/images/document2.svg +14 -0
- package/dist/assets/images/index.d.ts +4 -1
- package/dist/assets/images/index.js +4 -1
- package/dist/assets/images/index.ts +5 -0
- package/dist/assets/locales/en/index.json +11 -10
- package/dist/components/animations/CloudsAnimation.js +19 -3
- package/dist/components/animations/WeatherTrees.d.ts +6 -0
- package/dist/components/animations/WeatherTrees.js +36 -0
- package/dist/components/animations/index.d.ts +1 -0
- package/dist/components/animations/index.js +1 -0
- package/dist/components/badge/TextBadge.js +1 -1
- package/dist/components/folderPanel/folderDetails/FilesCounter.js +3 -5
- package/dist/components/footers/FooterButtons.d.ts +1 -1
- package/dist/components/footers/FooterButtons.js +2 -2
- package/dist/components/forms/BaseCounter.d.ts +2 -0
- package/dist/components/forms/BaseCounter.js +8 -0
- package/dist/components/forms/index.d.ts +1 -0
- package/dist/components/forms/index.js +1 -0
- package/dist/components/homeAssistant/HomeAssistantWrapper.d.ts +1 -1
- package/dist/components/homeAssistant/HomeAssistantWrapper.js +20 -6
- package/dist/components/inboxTile/InboxForwardBanner.js +2 -2
- package/dist/components/inboxTile/index.d.ts +1 -0
- package/dist/components/inboxTile/index.js +1 -0
- package/dist/components/inboxTile/panel/MessageCard.d.ts +2 -0
- package/dist/components/inboxTile/panel/MessageCard.js +14 -0
- package/dist/components/inboxTile/panel/MessageChatPanel.d.ts +4 -0
- package/dist/components/inboxTile/panel/MessageChatPanel.js +38 -0
- package/dist/components/inboxTile/panel/MessagePanel.d.ts +2 -0
- package/dist/components/inboxTile/panel/MessagePanel.js +12 -0
- package/dist/components/inboxTile/panel/index.d.ts +3 -0
- package/dist/components/inboxTile/panel/index.js +3 -0
- package/dist/components/myHomes/WrapperWithShadow.js +1 -1
- package/dist/components/myHomes/steps/MyHomeDetails.d.ts +1 -0
- package/dist/components/myHomes/steps/MyHomeDetails.js +1 -1
- package/dist/components/notifications/NotificationCard.d.ts +1 -1
- package/dist/components/notifications/NotificationCard.js +2 -47
- package/dist/components/rooms/VideosCounter.js +3 -5
- package/dist/hooks/inbox/index.d.ts +1 -0
- package/dist/hooks/inbox/index.js +1 -0
- package/dist/hooks/inbox/useMessagePanel.d.ts +7 -0
- package/dist/hooks/inbox/useMessagePanel.js +17 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/notifications/useNotificationsPanel.js +0 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/interfaces/appBar/UserProfile.interface.d.ts +2 -2
- package/dist/interfaces/footers/FooterButtons.interface.d.ts +1 -0
- package/dist/interfaces/forms/BaseCounter.interface.d.ts +5 -0
- package/dist/interfaces/forms/BaseCounter.interface.js +1 -0
- package/dist/interfaces/forms/index.d.ts +1 -0
- package/dist/interfaces/forms/index.js +1 -0
- package/dist/interfaces/inboxTile/MessageCard.interface.d.ts +16 -0
- package/dist/interfaces/inboxTile/MessageCard.interface.js +1 -0
- package/dist/interfaces/inboxTile/MessageChatPanel.interface.d.ts +12 -0
- package/dist/interfaces/inboxTile/MessageChatPanel.interface.js +1 -0
- package/dist/interfaces/inboxTile/MessagePanel.interface.d.ts +6 -0
- package/dist/interfaces/inboxTile/MessagePanel.interface.js +1 -0
- package/dist/interfaces/inboxTile/index.d.ts +3 -0
- package/dist/interfaces/inboxTile/index.js +3 -0
- package/dist/interfaces/notifications/NotificationsPanel.interface.d.ts +3 -2
- package/dist/mocks/inbox/index.d.ts +1 -0
- package/dist/mocks/inbox/index.js +1 -0
- package/dist/mocks/inbox/messages.d.ts +2 -0
- package/dist/mocks/inbox/messages.js +138 -0
- package/dist/mocks/index.d.ts +1 -0
- package/dist/mocks/index.js +1 -0
- package/dist/mocks/notifications/notifications.mock.js +4 -4
- package/dist/stories/assets/Illustrations.stories.js +2 -2
- package/dist/stories/inboxTile/MessagePanel.stories.d.ts +5 -0
- package/dist/stories/inboxTile/MessagePanel.stories.js +24 -0
- package/dist/theme/colors.d.ts +4 -1
- package/dist/theme/colors.js +4 -1
- package/dist/utils/Animations.utils.d.ts +6 -0
- package/dist/utils/Animations.utils.js +31 -0
- package/dist/utils/Avatars.utils.d.ts +1 -1
- package/dist/utils/Avatars.utils.js +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +1 -1
- package/src/assets/images/animations/index.ts +15 -0
- package/src/assets/images/animations/trees-cloudy.png +0 -0
- package/src/assets/images/animations/trees-day-fall.png +0 -0
- package/src/assets/images/animations/trees-day-summer.png +0 -0
- package/src/assets/images/animations/trees-day-winter.png +0 -0
- package/src/assets/images/animations/trees-evening.png +0 -0
- package/src/assets/images/animations/trees-morning.png +0 -0
- package/src/assets/images/animations/trees-night.png +0 -0
- package/src/assets/images/chat-bubble.svg +8 -0
- package/src/assets/images/document2.svg +14 -0
- package/src/assets/images/index.ts +5 -0
- package/src/assets/locales/en/index.json +11 -10
- package/src/components/animations/CloudsAnimation.tsx +34 -17
- package/src/components/animations/WeatherTrees.tsx +37 -0
- package/src/components/animations/index.ts +1 -0
- package/src/components/badge/TextBadge.tsx +1 -1
- package/src/components/folderPanel/folderDetails/FilesCounter.tsx +6 -21
- package/src/components/footers/FooterButtons.tsx +2 -1
- package/src/components/forms/BaseCounter.tsx +30 -0
- package/src/components/forms/index.ts +1 -0
- package/src/components/homeAssistant/HomeAssistantWrapper.tsx +31 -18
- package/src/components/inboxTile/InboxForwardBanner.tsx +5 -4
- package/src/components/inboxTile/index.ts +1 -0
- package/src/components/inboxTile/panel/MessageCard.tsx +112 -0
- package/src/components/inboxTile/panel/MessageChatPanel.tsx +105 -0
- package/src/components/inboxTile/panel/MessagePanel.tsx +64 -0
- package/src/components/inboxTile/panel/index.ts +3 -0
- package/src/components/myHomes/WrapperWithShadow.tsx +1 -0
- package/src/components/myHomes/steps/MyHomeDetails.tsx +1 -1
- package/src/components/notifications/NotificationCard.tsx +2 -106
- package/src/components/onboarding/pages/SignIn.tsx +1 -0
- package/src/components/rooms/VideosCounter.tsx +2 -18
- package/src/hooks/inbox/index.ts +1 -0
- package/src/hooks/inbox/useMessagePanel.ts +23 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/notifications/useNotificationsPanel.ts +0 -5
- package/src/index.ts +2 -0
- package/src/interfaces/appBar/UserProfile.interface.ts +2 -2
- package/src/interfaces/footers/FooterButtons.interface.ts +2 -1
- package/src/interfaces/forms/BaseCounter.interface.ts +5 -0
- package/src/interfaces/forms/index.ts +1 -0
- package/src/interfaces/inboxTile/MessageCard.interface.ts +18 -0
- package/src/interfaces/inboxTile/MessageChatPanel.interface.ts +13 -0
- package/src/interfaces/inboxTile/MessagePanel.interface.ts +7 -0
- package/src/interfaces/inboxTile/index.ts +3 -0
- package/src/interfaces/notifications/NotificationsPanel.interface.ts +3 -9
- package/src/mocks/inbox/index.ts +1 -0
- package/src/mocks/inbox/messages.ts +141 -0
- package/src/mocks/index.ts +1 -0
- package/src/mocks/notifications/notifications.mock.ts +4 -4
- package/src/stories/assets/Illustrations.stories.tsx +2 -0
- package/src/stories/inboxTile/MessagePanel.stories.tsx +47 -0
- package/src/theme/colors.ts +4 -1
- package/src/utils/Animations.utils.ts +39 -0
- package/src/utils/Avatars.utils.ts +2 -2
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { t } from 'i18next'
|
|
2
|
+
import {
|
|
3
|
+
Avatar,
|
|
4
|
+
Box,
|
|
5
|
+
Center,
|
|
6
|
+
chakra,
|
|
7
|
+
Container,
|
|
8
|
+
Divider,
|
|
9
|
+
Flex,
|
|
10
|
+
Stack,
|
|
11
|
+
Text,
|
|
12
|
+
} from '@chakra-ui/react'
|
|
13
|
+
import { ChatBubble } from '@/assets/images'
|
|
14
|
+
import { TextBadge } from '@/components'
|
|
15
|
+
import { formatDateWithAt } from '@/utils'
|
|
16
|
+
import { MessageCardI } from '@/interfaces'
|
|
17
|
+
|
|
18
|
+
export const MessageCard = ({
|
|
19
|
+
message,
|
|
20
|
+
onClick,
|
|
21
|
+
variant = 'inbox',
|
|
22
|
+
}: MessageCardI) => {
|
|
23
|
+
const { currentUser, from, subject, date, isNew, chatReplies, description } =
|
|
24
|
+
message
|
|
25
|
+
const formattedDate = formatDateWithAt({ date })
|
|
26
|
+
const showChatBubble = Number(chatReplies?.length) > 0
|
|
27
|
+
const isInbox = variant === 'inbox'
|
|
28
|
+
const isCurrentUser = currentUser?.userName === from
|
|
29
|
+
return (
|
|
30
|
+
<Flex gap="base">
|
|
31
|
+
{!isCurrentUser && !isInbox && (
|
|
32
|
+
<Avatar
|
|
33
|
+
size="sm"
|
|
34
|
+
name={from}
|
|
35
|
+
bg="blue.4"
|
|
36
|
+
fontWeight="bold"
|
|
37
|
+
color="neutral.white"
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
<Container
|
|
41
|
+
as={isInbox ? 'button' : 'div'}
|
|
42
|
+
bg={isCurrentUser ? 'yellow.6' : 'neutral.white'}
|
|
43
|
+
transition="background-color 0.3s"
|
|
44
|
+
textAlign="left"
|
|
45
|
+
_hover={isInbox ? { bg: 'lightGreen.1' } : {}}
|
|
46
|
+
onClick={() => onClick?.(message)}
|
|
47
|
+
>
|
|
48
|
+
<Box>
|
|
49
|
+
{!isCurrentUser && (
|
|
50
|
+
<Flex
|
|
51
|
+
justify="space-between"
|
|
52
|
+
align="center"
|
|
53
|
+
py="1"
|
|
54
|
+
pr="base"
|
|
55
|
+
pl={isNew ? '' : 'base'}
|
|
56
|
+
>
|
|
57
|
+
<Flex
|
|
58
|
+
gap="base"
|
|
59
|
+
align="center"
|
|
60
|
+
position="relative"
|
|
61
|
+
left={isNew ? '-13px' : ''}
|
|
62
|
+
>
|
|
63
|
+
{isNew && isInbox && (
|
|
64
|
+
<TextBadge
|
|
65
|
+
text="New"
|
|
66
|
+
showAnimation={false}
|
|
67
|
+
bgColor="violet.1"
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
<Text variant="home" color="gray.1">
|
|
71
|
+
{t('inbox.from')}
|
|
72
|
+
<chakra.span color="gray.4">{from}</chakra.span>
|
|
73
|
+
</Text>
|
|
74
|
+
</Flex>
|
|
75
|
+
<Text variant="home" fontSize="xs">
|
|
76
|
+
{formattedDate}
|
|
77
|
+
</Text>
|
|
78
|
+
</Flex>
|
|
79
|
+
)}
|
|
80
|
+
{isInbox && <Divider />}
|
|
81
|
+
<Stack spacing="base" p="base">
|
|
82
|
+
<Flex align="center" justify="space-between">
|
|
83
|
+
<Text variant="home" fontWeight="bold">
|
|
84
|
+
{subject}
|
|
85
|
+
</Text>
|
|
86
|
+
{showChatBubble && isInbox && (
|
|
87
|
+
<Center
|
|
88
|
+
backgroundImage={`url(${ChatBubble})`}
|
|
89
|
+
backgroundRepeat="no-repeat"
|
|
90
|
+
backgroundSize="contain"
|
|
91
|
+
backgroundPosition="bottom"
|
|
92
|
+
w="20px"
|
|
93
|
+
h="24px"
|
|
94
|
+
>
|
|
95
|
+
<Text fontSize="10px" color="blue.2" fontWeight="bold">
|
|
96
|
+
{chatReplies?.length}
|
|
97
|
+
</Text>
|
|
98
|
+
</Center>
|
|
99
|
+
)}
|
|
100
|
+
</Flex>
|
|
101
|
+
{isInbox && (
|
|
102
|
+
<Text variant="home" noOfLines={3} textOverflow="ellipsis">
|
|
103
|
+
{description}
|
|
104
|
+
</Text>
|
|
105
|
+
)}
|
|
106
|
+
{!isInbox && <Text variant="home">{description}</Text>}
|
|
107
|
+
</Stack>
|
|
108
|
+
</Box>
|
|
109
|
+
</Container>
|
|
110
|
+
</Flex>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { t } from 'i18next'
|
|
3
|
+
import {
|
|
4
|
+
Box,
|
|
5
|
+
DrawerBody,
|
|
6
|
+
DrawerContent,
|
|
7
|
+
DrawerFooter,
|
|
8
|
+
DrawerHeader,
|
|
9
|
+
Stack,
|
|
10
|
+
Text,
|
|
11
|
+
} from '@chakra-ui/react'
|
|
12
|
+
import QuillEditor from 'react-quill'
|
|
13
|
+
import { Document2 } from '@/assets/images'
|
|
14
|
+
import {
|
|
15
|
+
BackCircleButton,
|
|
16
|
+
FooterButtons,
|
|
17
|
+
MessageCard,
|
|
18
|
+
PanelHeader,
|
|
19
|
+
up,
|
|
20
|
+
WrapperWithShadow,
|
|
21
|
+
} from '@/components'
|
|
22
|
+
import { MessageChatPanelI } from '@/interfaces'
|
|
23
|
+
|
|
24
|
+
import 'react-quill/dist/quill.snow.css'
|
|
25
|
+
import '@/styles/quill.css'
|
|
26
|
+
|
|
27
|
+
export const MessageChatPanel = ({
|
|
28
|
+
message,
|
|
29
|
+
onBack,
|
|
30
|
+
onClose,
|
|
31
|
+
onReply,
|
|
32
|
+
}: MessageChatPanelI) => {
|
|
33
|
+
const [value, setValue] = useState('')
|
|
34
|
+
const onChange = (content: string) => {
|
|
35
|
+
setValue(content)
|
|
36
|
+
}
|
|
37
|
+
return (
|
|
38
|
+
<DrawerContent bg="lightBlue.1">
|
|
39
|
+
<DrawerHeader p="0">
|
|
40
|
+
<PanelHeader
|
|
41
|
+
handleCloseButton={onClose}
|
|
42
|
+
title={message?.from ?? ''}
|
|
43
|
+
icon={Document2}
|
|
44
|
+
/>
|
|
45
|
+
</DrawerHeader>
|
|
46
|
+
<DrawerBody p="0">
|
|
47
|
+
<Box bg="lightBlue.2" py="2" px="base">
|
|
48
|
+
<BackCircleButton onClick={onBack} />
|
|
49
|
+
</Box>
|
|
50
|
+
<Stack spacing="base" p="base" pb="4">
|
|
51
|
+
{message?.chatReplies?.map((reply) => (
|
|
52
|
+
<MessageCard
|
|
53
|
+
key={reply._id}
|
|
54
|
+
message={{
|
|
55
|
+
...reply,
|
|
56
|
+
currentUser: message.currentUser,
|
|
57
|
+
}}
|
|
58
|
+
variant="chat"
|
|
59
|
+
/>
|
|
60
|
+
))}
|
|
61
|
+
</Stack>
|
|
62
|
+
</DrawerBody>
|
|
63
|
+
<DrawerFooter p="0" maxH="400px">
|
|
64
|
+
<WrapperWithShadow animation={up} fadeDelay={0.2}>
|
|
65
|
+
<Stack spacing="base">
|
|
66
|
+
<Text>{t('inbox.createReply')}</Text>
|
|
67
|
+
<QuillEditor
|
|
68
|
+
theme="snow"
|
|
69
|
+
value={value}
|
|
70
|
+
modules={{ toolbar }}
|
|
71
|
+
onChange={onChange}
|
|
72
|
+
placeholder={t('inbox.enterContent')}
|
|
73
|
+
/>
|
|
74
|
+
<FooterButtons
|
|
75
|
+
px="0"
|
|
76
|
+
button1={{
|
|
77
|
+
buttonStyle: 'secondaryFooter',
|
|
78
|
+
label: t('buttons.send'),
|
|
79
|
+
isDisabled: Number(value.length) === 0,
|
|
80
|
+
onClick: () =>
|
|
81
|
+
onReply({
|
|
82
|
+
id: message?._id ?? '',
|
|
83
|
+
message: value,
|
|
84
|
+
}),
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
</Stack>
|
|
88
|
+
</WrapperWithShadow>
|
|
89
|
+
</DrawerFooter>
|
|
90
|
+
</DrawerContent>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const toolbar = [
|
|
95
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
96
|
+
['blockquote', 'link', 'image'],
|
|
97
|
+
[{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }],
|
|
98
|
+
[{ script: 'sub' }, { script: 'super' }],
|
|
99
|
+
[{ indent: '-1' }, { indent: '+1' }],
|
|
100
|
+
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
|
101
|
+
|
|
102
|
+
[{ color: [] }, { background: [] }],
|
|
103
|
+
|
|
104
|
+
['clean'],
|
|
105
|
+
]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { t } from 'i18next'
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
DrawerBody,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerHeader,
|
|
7
|
+
Stack,
|
|
8
|
+
} from '@chakra-ui/react'
|
|
9
|
+
import { Inbox } from '@/assets/images'
|
|
10
|
+
import {
|
|
11
|
+
BaseCounter,
|
|
12
|
+
MessageCard,
|
|
13
|
+
PanelHeader,
|
|
14
|
+
SelectInput,
|
|
15
|
+
} from '@/components'
|
|
16
|
+
import { MessagePanelI } from '@/interfaces'
|
|
17
|
+
import { useMessagePanel } from '@/hooks'
|
|
18
|
+
import { pluralize } from '@/utils'
|
|
19
|
+
|
|
20
|
+
export const MessagePanel = ({ messages, onClick, onClose }: MessagePanelI) => {
|
|
21
|
+
const { currentSort, sortedMessages, handleSelectItem, items } =
|
|
22
|
+
useMessagePanel(messages)
|
|
23
|
+
|
|
24
|
+
const baseCounterText = `${t('counter.showing')} ${sortedMessages.length} ${t(
|
|
25
|
+
'counter.of'
|
|
26
|
+
)} ${messages.length} ${pluralize(
|
|
27
|
+
sortedMessages.length,
|
|
28
|
+
t('inbox.message').toLowerCase()
|
|
29
|
+
)} `
|
|
30
|
+
return (
|
|
31
|
+
<DrawerContent bg="lightBlue.1">
|
|
32
|
+
<DrawerHeader p="0">
|
|
33
|
+
<PanelHeader
|
|
34
|
+
handleCloseButton={onClose}
|
|
35
|
+
title={t('inbox.message')}
|
|
36
|
+
icon={Inbox}
|
|
37
|
+
/>
|
|
38
|
+
</DrawerHeader>
|
|
39
|
+
<DrawerBody p="0">
|
|
40
|
+
<Stack spacing="base" pb="4">
|
|
41
|
+
<Box p="base" bg="lightBlue.2">
|
|
42
|
+
<SelectInput
|
|
43
|
+
handleClick={handleSelectItem}
|
|
44
|
+
initialValue={currentSort}
|
|
45
|
+
items={items}
|
|
46
|
+
/>
|
|
47
|
+
</Box>
|
|
48
|
+
<Box px="base">
|
|
49
|
+
<BaseCounter text={baseCounterText} />
|
|
50
|
+
</Box>
|
|
51
|
+
<Stack spacing="1" pl="26px" pr="base">
|
|
52
|
+
{sortedMessages.map((message) => (
|
|
53
|
+
<MessageCard
|
|
54
|
+
key={message._id}
|
|
55
|
+
message={message}
|
|
56
|
+
onClick={onClick}
|
|
57
|
+
/>
|
|
58
|
+
))}
|
|
59
|
+
</Stack>
|
|
60
|
+
</Stack>
|
|
61
|
+
</DrawerBody>
|
|
62
|
+
</DrawerContent>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -34,7 +34,7 @@ const upAnimation = keyframes`
|
|
|
34
34
|
to { transform: translateY(0); box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.07)}
|
|
35
35
|
`
|
|
36
36
|
|
|
37
|
-
const up = `${upAnimation} 200ms ease forwards`
|
|
37
|
+
export const up = `${upAnimation} 200ms ease forwards`
|
|
38
38
|
|
|
39
39
|
export const MyHomeDetails = ({
|
|
40
40
|
handleCreateHomeClick,
|
|
@@ -7,115 +7,11 @@ import { formatDateWithAt } from '@/utils'
|
|
|
7
7
|
export const NotificationCard = ({
|
|
8
8
|
_id,
|
|
9
9
|
createdAt,
|
|
10
|
+
label,
|
|
10
11
|
message,
|
|
11
12
|
onDismiss,
|
|
12
13
|
status,
|
|
13
|
-
type,
|
|
14
14
|
}: NotificationCardI & Pick<NotificationsPanelI, 'onDismiss'>) => {
|
|
15
|
-
const actionLabels: Record<
|
|
16
|
-
NotificationCardI['type'],
|
|
17
|
-
Record<NotificationCardI['status'], string>
|
|
18
|
-
> = {
|
|
19
|
-
contact: {
|
|
20
|
-
added: `${t('notifications.types.contact')} ${t(
|
|
21
|
-
'notifications.status.added'
|
|
22
|
-
)}`,
|
|
23
|
-
removed: `${t('notifications.types.contact')} ${t(
|
|
24
|
-
'notifications.status.removed'
|
|
25
|
-
)}`,
|
|
26
|
-
shared: `${t('notifications.status.shared')} ${t(
|
|
27
|
-
'notifications.types.contact'
|
|
28
|
-
)}`,
|
|
29
|
-
updated: `${t('notifications.types.contact')} ${t(
|
|
30
|
-
'notifications.status.updated'
|
|
31
|
-
)}`,
|
|
32
|
-
},
|
|
33
|
-
file: {
|
|
34
|
-
added: `${t('notifications.types.file')} ${t(
|
|
35
|
-
'notifications.status.added'
|
|
36
|
-
)}`,
|
|
37
|
-
removed: `${t('notifications.types.file')} ${t(
|
|
38
|
-
'notifications.status.removed'
|
|
39
|
-
)}`,
|
|
40
|
-
shared: `${t('notifications.status.shared')} ${t(
|
|
41
|
-
'notifications.types.file'
|
|
42
|
-
)}`,
|
|
43
|
-
updated: `${t('notifications.types.file')} ${t(
|
|
44
|
-
'notifications.status.updated'
|
|
45
|
-
)}`,
|
|
46
|
-
},
|
|
47
|
-
folder: {
|
|
48
|
-
added: `${t('notifications.types.folder')} ${t(
|
|
49
|
-
'notifications.status.added'
|
|
50
|
-
)}`,
|
|
51
|
-
removed: `${t('notifications.types.folder')} ${t(
|
|
52
|
-
'notifications.status.removed'
|
|
53
|
-
)}`,
|
|
54
|
-
shared: `${t('notifications.status.shared')} ${t(
|
|
55
|
-
'notifications.types.folder'
|
|
56
|
-
)}`,
|
|
57
|
-
updated: `${t('notifications.types.folder')} ${t(
|
|
58
|
-
'notifications.status.updated'
|
|
59
|
-
)}`,
|
|
60
|
-
},
|
|
61
|
-
payment: {
|
|
62
|
-
added: `${t('notifications.types.payment')} ${t(
|
|
63
|
-
'notifications.status.added'
|
|
64
|
-
)}`,
|
|
65
|
-
removed: `${t('notifications.types.payment')} ${t(
|
|
66
|
-
'notifications.status.removed'
|
|
67
|
-
)}`,
|
|
68
|
-
shared: `${t('notifications.status.shared')} ${t(
|
|
69
|
-
'notifications.types.payment'
|
|
70
|
-
)}`,
|
|
71
|
-
updated: `${t('notifications.types.payment')} ${t(
|
|
72
|
-
'notifications.status.updated'
|
|
73
|
-
)}`,
|
|
74
|
-
},
|
|
75
|
-
receipt: {
|
|
76
|
-
added: `${t('notifications.types.receipt')} ${t(
|
|
77
|
-
'notifications.status.added'
|
|
78
|
-
)}`,
|
|
79
|
-
removed: `${t('notifications.types.receipt')} ${t(
|
|
80
|
-
'notifications.status.removed'
|
|
81
|
-
)}`,
|
|
82
|
-
shared: `${t('notifications.status.shared')} ${t(
|
|
83
|
-
'notifications.types.receipt'
|
|
84
|
-
)}`,
|
|
85
|
-
updated: `${t('notifications.types.receipt')} ${t(
|
|
86
|
-
'notifications.status.updated'
|
|
87
|
-
)}`,
|
|
88
|
-
},
|
|
89
|
-
tile: {
|
|
90
|
-
added: `${t('notifications.types.tile')} ${t(
|
|
91
|
-
'notifications.status.added'
|
|
92
|
-
)}`,
|
|
93
|
-
removed: `${t('notifications.types.tile')} ${t(
|
|
94
|
-
'notifications.status.removed'
|
|
95
|
-
)}`,
|
|
96
|
-
shared: `${t('notifications.status.shared')} ${t(
|
|
97
|
-
'notifications.types.tile'
|
|
98
|
-
)}`,
|
|
99
|
-
updated: `${t('notifications.types.tile')} ${t(
|
|
100
|
-
'notifications.status.updated'
|
|
101
|
-
)}`,
|
|
102
|
-
},
|
|
103
|
-
user: {
|
|
104
|
-
added: `${t('notifications.types.user')} ${t(
|
|
105
|
-
'notifications.status.added'
|
|
106
|
-
)}`,
|
|
107
|
-
removed: `${t('notifications.types.user')} ${t(
|
|
108
|
-
'notifications.status.removed'
|
|
109
|
-
)}`,
|
|
110
|
-
shared: `${t('notifications.status.shared')} ${t(
|
|
111
|
-
'notifications.types.user'
|
|
112
|
-
)}`,
|
|
113
|
-
updated: `${t('notifications.types.user')} ${t(
|
|
114
|
-
'notifications.status.updated'
|
|
115
|
-
)}`,
|
|
116
|
-
},
|
|
117
|
-
}
|
|
118
|
-
|
|
119
15
|
const bgColors: Record<NotificationCardI['status'], string> = {
|
|
120
16
|
added: 'lightGreen.3',
|
|
121
17
|
removed: 'error.1',
|
|
@@ -140,7 +36,7 @@ export const NotificationCard = ({
|
|
|
140
36
|
textTransform="uppercase"
|
|
141
37
|
color={colors[status]}
|
|
142
38
|
>
|
|
143
|
-
{
|
|
39
|
+
{label}
|
|
144
40
|
</Text>
|
|
145
41
|
<Flex gap="1" align="center">
|
|
146
42
|
<Text variant="date">{formatDateWithAt({ date: createdAt })}</Text>
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { t } from 'i18next'
|
|
2
|
-
import { Box, Flex, Text, chakra } from '@chakra-ui/react'
|
|
3
|
-
import { BeatLoader } from 'react-spinners'
|
|
4
|
-
import { colors } from '@/theme/colors'
|
|
5
2
|
import { VideosCounterI } from '@/interfaces'
|
|
6
3
|
import { pluralize } from '@/utils'
|
|
4
|
+
import { BaseCounter } from '@/components'
|
|
7
5
|
|
|
8
6
|
export const VideosCounter = ({ totalVideos, uploading }: VideosCounterI) => {
|
|
9
7
|
const videos = pluralize(totalVideos, t('roomVideo.more'))
|
|
@@ -11,20 +9,6 @@ export const VideosCounter = ({ totalVideos, uploading }: VideosCounterI) => {
|
|
|
11
9
|
const text = `${t('roomVideo.youCan')} ${totalVideos} ${videos}`
|
|
12
10
|
|
|
13
11
|
return (
|
|
14
|
-
<
|
|
15
|
-
<Flex justify="space-between" align="center">
|
|
16
|
-
{!uploading && <Text variant="home">{text}</Text>}
|
|
17
|
-
{uploading && (
|
|
18
|
-
<Text variant="home">
|
|
19
|
-
<chakra.span fontWeight="bold">
|
|
20
|
-
{t('folderSharing.uploading')}
|
|
21
|
-
</chakra.span>
|
|
22
|
-
<chakra.span ml="2">
|
|
23
|
-
<BeatLoader size="4px" color={colors.blue[6]} />
|
|
24
|
-
</chakra.span>
|
|
25
|
-
</Text>
|
|
26
|
-
)}
|
|
27
|
-
</Flex>
|
|
28
|
-
</Box>
|
|
12
|
+
<BaseCounter text={text} uploading={uploading} uploadingText={videos} />
|
|
29
13
|
)
|
|
30
14
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useMessagePanel'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { t } from 'i18next'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import { InboxMessageI, SelectItemI } from '@/interfaces'
|
|
4
|
+
|
|
5
|
+
export const useMessagePanel = (messages: InboxMessageI[]) => {
|
|
6
|
+
const [sortedMessages, setSortedMessages] = useState(messages)
|
|
7
|
+
const [currentSort, setCurrentSort] = useState<string>(t('forms.sortBy'))
|
|
8
|
+
|
|
9
|
+
const handleSelectItem = (item: string | SelectItemI<string>) => {
|
|
10
|
+
if (typeof item !== 'string') return
|
|
11
|
+
setCurrentSort(item)
|
|
12
|
+
|
|
13
|
+
if (item === t('forms.sortBy')) {
|
|
14
|
+
return setSortedMessages(messages)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
setSortedMessages(messages.filter((message) => message.isNew))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const items = [t('forms.sortBy'), t('forms.new')] as string[]
|
|
21
|
+
|
|
22
|
+
return { currentSort, sortedMessages, handleSelectItem, items }
|
|
23
|
+
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -31,11 +31,6 @@ export const useNotificationsPanel = ({
|
|
|
31
31
|
|
|
32
32
|
const items = [
|
|
33
33
|
t('forms.sortBy'),
|
|
34
|
-
t('notifications.types.contact'),
|
|
35
|
-
t('notifications.types.file'),
|
|
36
|
-
t('notifications.types.folder'),
|
|
37
|
-
t('notifications.types.payment'),
|
|
38
|
-
t('notifications.types.receipt'),
|
|
39
34
|
t('notifications.status.added'),
|
|
40
35
|
t('notifications.status.removed'),
|
|
41
36
|
t('notifications.status.shared'),
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type ButtonStyleProps = 'primaryFooter' | 'secondaryFooter' | 'tertiaryFooter'
|
|
2
2
|
|
|
3
3
|
export interface FooterButtonI {
|
|
4
4
|
buttonStyle: ButtonStyleProps | string
|
|
@@ -13,4 +13,5 @@ export interface FooterButtonsI {
|
|
|
13
13
|
button1?: FooterButtonI
|
|
14
14
|
button2?: FooterButtonI | null
|
|
15
15
|
button3?: FooterButtonI
|
|
16
|
+
px?: string
|
|
16
17
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UserProfileI } from '@/interfaces'
|
|
2
|
+
|
|
3
|
+
export interface InboxMessageI {
|
|
4
|
+
_id: string
|
|
5
|
+
currentUser?: Partial<UserProfileI>
|
|
6
|
+
chatReplies?: InboxMessageI[]
|
|
7
|
+
description: string
|
|
8
|
+
date: Date
|
|
9
|
+
from: string
|
|
10
|
+
isNew?: boolean
|
|
11
|
+
subject: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface MessageCardI {
|
|
15
|
+
message: InboxMessageI
|
|
16
|
+
onClick?: (message: InboxMessageI) => void
|
|
17
|
+
variant?: 'inbox' | 'chat'
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InboxMessageI } from '@/interfaces'
|
|
2
|
+
|
|
3
|
+
interface InboxMessageReplyI {
|
|
4
|
+
id: string
|
|
5
|
+
message: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface MessageChatPanelI {
|
|
9
|
+
message?: InboxMessageI
|
|
10
|
+
onReply: (props: InboxMessageReplyI) => void
|
|
11
|
+
onClose: () => void
|
|
12
|
+
onBack: () => void
|
|
13
|
+
}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
type NotificationType =
|
|
2
|
-
| 'file'
|
|
3
|
-
| 'folder'
|
|
4
|
-
| 'contact'
|
|
5
|
-
| 'receipt'
|
|
6
|
-
| 'user'
|
|
7
|
-
| 'tile'
|
|
8
|
-
| 'payment'
|
|
1
|
+
type NotificationType = 'simple'
|
|
9
2
|
type NotificationStatus = 'added' | 'removed' | 'updated' | 'shared'
|
|
10
3
|
|
|
11
4
|
export interface NotificationCardI {
|
|
12
5
|
active: boolean
|
|
13
6
|
createdAt: Date
|
|
14
7
|
_id: string
|
|
8
|
+
label: string
|
|
15
9
|
message: string
|
|
16
10
|
status: NotificationStatus
|
|
17
|
-
type
|
|
11
|
+
type?: NotificationType
|
|
18
12
|
}
|
|
19
13
|
|
|
20
14
|
export interface NotificationsPanelI {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './messages'
|