Skip to content

Commit 8fb8dfa

Browse files
committed
feat: delete chat room messages
1 parent 25c5d9d commit 8fb8dfa

File tree

22 files changed

+539
-135
lines changed

22 files changed

+539
-135
lines changed

packages/components/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @baseapp-frontend/components
22

3+
## 1.0.8
4+
5+
### Patch Changes
6+
7+
- Enabled deletion of chat room messages
8+
39
## 1.0.7
410

511
### Patch Changes

packages/components/__generated__/MessageDeleteMutation.graphql.ts

+280
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/index.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import { DefaultHoverOverlayProps } from './types'
99
const DefaultHoverOverlay: FC<DefaultHoverOverlayProps> = ({
1010
offsetRight,
1111
offsetTop,
12-
enableDelete,
12+
showDeleteButton,
1313
isDeletingItem,
14+
disableDeleteButton,
1415
handleDeleteDialogOpen,
1516
actions = [],
1617
handleLongPressItemOptionsClose,
@@ -20,10 +21,10 @@ const DefaultHoverOverlay: FC<DefaultHoverOverlayProps> = ({
2021
offsetTop={offsetTop}
2122
aria-label="actions overlay"
2223
>
23-
{enableDelete && (
24+
{showDeleteButton && (
2425
<IconButton
2526
onClick={handleDeleteDialogOpen}
26-
disabled={isDeletingItem}
27+
disabled={isDeletingItem || disableDeleteButton}
2728
aria-label="delete item"
2829
>
2930
<TrashCanIcon />

packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/types.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { ActionOverlayProps } from '../types'
33
export interface DefaultHoverOverlayProps
44
extends Pick<
55
ActionOverlayProps,
6-
'actions' | 'offsetRight' | 'offsetTop' | 'enableDelete' | 'isDeletingItem'
6+
| 'actions'
7+
| 'offsetRight'
8+
| 'offsetTop'
9+
| 'showDeleteButton'
10+
| 'isDeletingItem'
11+
| 'disableDeleteButton'
712
> {
813
handleDeleteDialogOpen: () => void
914
handleLongPressItemOptionsClose: () => void

packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/index.tsx

+13-5
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import { ThreeDotsMenuHoverOverlayProps } from './types'
1212
const ThreeDotsMenuHoverOverlay: FC<ThreeDotsMenuHoverOverlayProps> = ({
1313
offsetRight,
1414
offsetTop,
15-
enableDelete,
15+
showDeleteButton,
1616
isDeletingItem,
17+
disableDeleteButton,
1718
handleDeleteDialogOpen,
1819
actions = [],
1920
handleClosePopover,
@@ -54,10 +55,17 @@ const ThreeDotsMenuHoverOverlay: FC<ThreeDotsMenuHoverOverlayProps> = ({
5455
</MenuItem>
5556
)
5657
})}
57-
{enableDelete && (
58-
<MenuItem onClick={handleDeleteDialogOpen} disabled={isDeletingItem}>
59-
<TrashCanIcon />
60-
<Typography variant="body2" color="error">
58+
{showDeleteButton && (
59+
<MenuItem
60+
onClick={handleDeleteDialogOpen}
61+
disabled={isDeletingItem || disableDeleteButton}
62+
color="disabled"
63+
>
64+
<TrashCanIcon sx={{ color: disableDeleteButton ? 'text.disabled' : 'error.main' }} />
65+
<Typography
66+
variant="body2"
67+
color={disableDeleteButton ? 'text.disabled' : 'error.main'}
68+
>
6169
Delete
6270
</Typography>
6371
</MenuItem>

packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/types.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import { ActionOverlayProps } from '../types'
55
export interface ThreeDotsMenuHoverOverlayProps
66
extends Pick<
77
ActionOverlayProps,
8-
'actions' | 'offsetRight' | 'offsetTop' | 'enableDelete' | 'isDeletingItem'
8+
| 'actions'
9+
| 'offsetRight'
10+
| 'offsetTop'
11+
| 'showDeleteButton'
12+
| 'isDeletingItem'
13+
| 'disableDeleteButton'
914
> {
1015
handleDeleteDialogOpen: () => void
1116
handleClosePopover: () => void

packages/components/modules/__shared__/web/ActionsOverlay/__storybook__/ActionsOverlay.mdx

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import { Meta } from '@storybook/addon-docs'
1919
- **actions** (OverlayAction[]): The list of actions desired for the child component. Note that to implement a delete action, the component provides a enabler, loading and click handler props specifically for that action (see props below).
2020
- **title** (string): Title for the child component (currently only used on the delete dialog).
2121
- **children** (ReactNode): The child component to be wrapped.
22-
- **enableDelete** (boolean): Enables the delete action inside the tooltip/swippable drawer.
22+
- **showDeleteButton** (boolean): Renders the delete action inside the tooltip/swippable drawer.
2323
- **isDeletingItem** (boolean): Mutation loading state for the delete action.
2424
- **handleDeleteItem** (function): Callback function to handle deletion.
25+
- **disableDeleteButton** (function): Disables the delete button.
2526
- **offsetTop** (number): Number to offset the top positioning of the default tooltip position (only affects tooltip).
2627
- **offsetRight** (number): Number to offset the right positioning of the default tooltip position (only affects tooltip).
2728
- **ContainerProps** (BoxProps): Props for the parent `Box` component that wraps the child component.
@@ -45,7 +46,7 @@ export const DefaultActionsOverlay = (
4546
return (
4647
<ActionsOverlay
4748
title='Button',
48-
enableDelete={true}
49+
showDeleteButton={true}
4950
handleDeleteItem={() => {}}
5051
actions={[
5152
{

0 commit comments

Comments
 (0)