-
Notifications
You must be signed in to change notification settings - Fork 13.8k
feat: New Collapse component for Apps logs #36142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
321dcec
feat: New Collapse component for Apps logs
MartinSchoeler ae6ffdd
Create nice-items-marry.md
MartinSchoeler a79ccbb
chore: Fix missing type
MartinSchoeler 9a3600e
test: fix test
MartinSchoeler 4756514
Merge branch 'develop' into feat/app-logs-item-redesign
MartinSchoeler 24d2c41
chore: ts
MartinSchoeler c041374
chore: rename component
MartinSchoeler ea07b72
chore: reviews
MartinSchoeler 79d4ff5
chore: `style` -> `css-in-js`
MartinSchoeler 3259233
Merge branch 'develop' into feat/app-logs-item-redesign
MartinSchoeler 39ee176
chore: snapshot update
MartinSchoeler 0c15eb3
chore: sad
MartinSchoeler c1c9d7d
Use common date formatter hook
tassoevan f459ed4
Adjust changeset
tassoevan 060912b
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into feat…
tassoevan 13dae40
Merge branch 'develop' into feat/app-logs-item-redesign
kodiakhq[bot] 72ee6be
Merge branch 'develop' into feat/app-logs-item-redesign
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@rocket.chat/meteor": patch | ||
| "@rocket.chat/i18n": patch | ||
| --- | ||
|
|
||
| Implements new component for Apps Logs View | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
apps/meteor/client/views/marketplace/AppDetailsPage/tabs/AppLogs/AppLogsItem.spec.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /* eslint-disable @typescript-eslint/naming-convention */ | ||
| import { mockAppRoot } from '@rocket.chat/mock-providers'; | ||
| import { composeStories } from '@storybook/react'; | ||
| import { render } from '@testing-library/react'; | ||
| import { axe } from 'jest-axe'; | ||
|
|
||
| import * as stories from './AppLogsItem.stories'; | ||
|
|
||
| const testCases = Object.values(composeStories(stories)).map((Story) => [Story.storyName || 'Story', Story]); | ||
|
|
||
| test.each(testCases)(`renders AppLogsItem without crashing`, async (_storyname, Story) => { | ||
| const view = render(<Story />, { wrapper: mockAppRoot().build() }); | ||
| expect(view.baseElement).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| test.each(testCases)('AppLogsItem should have no a11y violations', async (_storyname, Story) => { | ||
| const { container } = render(<Story />, { wrapper: mockAppRoot().build() }); | ||
|
|
||
| const results = await axe(container); | ||
| expect(results).toHaveNoViolations(); | ||
| }); |
43 changes: 43 additions & 0 deletions
43
apps/meteor/client/views/marketplace/AppDetailsPage/tabs/AppLogs/AppLogsItem.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import type { Meta, StoryFn } from '@storybook/react'; | ||
| import type { ComponentProps } from 'react'; | ||
|
|
||
| import AppLogsItem from './AppLogsItem'; | ||
| import { Collapse } from './Components/Collapse'; | ||
|
|
||
| export default { | ||
| title: 'Components/AppLogsItem', | ||
| component: AppLogsItem, | ||
| decorators: [(fn) => <Collapse style={{ padding: 24 }}>{fn()}</Collapse>], | ||
| args: { | ||
| _id: '683da1e32025cfca7b3d8238', | ||
| appId: 'ce0e318b-ffc0-4ce4-832b-f1b464beb22a', | ||
| method: 'app:checkPostMessageSent', | ||
| entries: [ | ||
| { | ||
| caller: 'anonymous OR constructor -> handleApp', | ||
| severity: 'debug', | ||
| method: 'app:checkPostMessageSent', | ||
| timestamp: '2025-06-02T13:06:43.772Z', | ||
| args: ["'checkPostMessageSent' is being called..."], | ||
| }, | ||
| { | ||
| caller: 'anonymous OR constructor', | ||
| severity: 'debug', | ||
| method: 'app:checkPostMessageSent', | ||
| timestamp: '2025-06-02T13:06:43.777Z', | ||
| args: ["'checkPostMessageSent' was successfully called! The result is:", 'false'], | ||
| }, | ||
| ], | ||
| startTime: '2025-06-02T13:06:43.771Z', | ||
| endTime: '2025-06-02T13:06:43.777Z', | ||
| totalTime: 6, | ||
| _createdAt: '2025-06-02T13:06:43.777Z', | ||
| instanceId: 'b97ce445-b9ff-4513-8206-966afd799cd6', | ||
| _updatedAt: '2025-06-02T13:06:43.778Z', | ||
| }, | ||
| parameters: { | ||
| layout: 'fullscreen', | ||
| }, | ||
| } satisfies Meta<ComponentProps<typeof AppLogsItem>>; | ||
|
|
||
| export const Simple: StoryFn<ComponentProps<typeof AppLogsItem>> = (args) => <AppLogsItem {...args} />; |
64 changes: 47 additions & 17 deletions
64
apps/meteor/client/views/marketplace/AppDetailsPage/tabs/AppLogs/AppLogsItem.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 4 additions & 12 deletions
16
apps/meteor/client/views/marketplace/AppDetailsPage/tabs/AppLogs/AppLogsItemEntry.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
apps/meteor/client/views/marketplace/AppDetailsPage/tabs/AppLogs/AppLogsItemField.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { Box } from '@rocket.chat/fuselage'; | ||
| import type { ComponentProps, ReactNode } from 'react'; | ||
|
|
||
| type AppsLogItemFieldProps = { | ||
| field: ReactNode | string; | ||
| label: string; | ||
| } & ComponentProps<typeof Box>; | ||
|
|
||
| export const AppsLogItemField = ({ field, label, ...props }: AppsLogItemFieldProps) => { | ||
| return ( | ||
| <Box mb={16} display='flex' color='default' flexDirection='column' {...props}> | ||
| <Box fontWeight={700}>{label}</Box> | ||
| {field} | ||
| </Box> | ||
| ); | ||
| }; |
41 changes: 41 additions & 0 deletions
41
...teor/client/views/marketplace/AppDetailsPage/tabs/AppLogs/Components/Collapse.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import type { StoryFn } from '@storybook/react'; | ||
|
|
||
| import { Collapse } from './Collapse'; | ||
| import { CollapseButton } from './CollapseButton'; | ||
| import { CollapsibleRegion } from './CollapsibleRegion'; | ||
|
|
||
| export default { | ||
| title: 'Components/Collapse', | ||
| component: Collapse, | ||
|
|
||
| args: { | ||
| expanded: true, | ||
| }, | ||
|
|
||
| parameters: { | ||
| layout: 'centered', | ||
| }, | ||
| }; | ||
|
|
||
| const Template: StoryFn = (args) => { | ||
| return ( | ||
| <Collapse> | ||
| <CollapseButton | ||
| onClick={() => { | ||
| args.expanded = !args.expanded; | ||
| }} | ||
| expanded={args.expanded} | ||
| _id='collapse-item' | ||
| > | ||
| Click Me | ||
| </CollapseButton> | ||
| <CollapsibleRegion expanded={args.expanded} _id='collapse-item'> | ||
| <p>This is the content of the panel that can be activated.</p> | ||
| <button>Click Me</button> | ||
| <p>More content can go here.</p> | ||
| </CollapsibleRegion> | ||
| </Collapse> | ||
| ); | ||
| }; | ||
|
|
||
| export const Default = Template.bind({}); |
10 changes: 10 additions & 0 deletions
10
apps/meteor/client/views/marketplace/AppDetailsPage/tabs/AppLogs/Components/Collapse.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { Box } from '@rocket.chat/fuselage'; | ||
| import type { ComponentProps } from 'react'; | ||
|
|
||
| export const Collapse = (props: ComponentProps<typeof Box>) => { | ||
| return ( | ||
| <Box {...props} is='dl'> | ||
| {props.children} | ||
| </Box> | ||
| ); | ||
| }; |
43 changes: 43 additions & 0 deletions
43
...meteor/client/views/marketplace/AppDetailsPage/tabs/AppLogs/Components/CollapseButton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { css } from '@rocket.chat/css-in-js'; | ||
| import { Box, Chevron, Palette } from '@rocket.chat/fuselage'; | ||
| import type { CSSProperties, ReactNode } from 'react'; | ||
|
|
||
| type CollapseButtonProps = { | ||
| children: ReactNode; | ||
| _id: string; | ||
| expanded?: boolean; | ||
| onClick: () => void; | ||
| }; | ||
|
|
||
| export const CollapseButton = ({ _id, children, expanded, onClick }: CollapseButtonProps) => { | ||
| const clickable = css` | ||
| background: ${Palette.surface['surface-light']}; | ||
|
|
||
| &:hover { | ||
| background: ${Palette.surface['surface-tint']}; | ||
| } | ||
| `; | ||
| const style: CSSProperties = { whiteSpace: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden' }; | ||
| return ( | ||
| <Box is='dt' style={style}> | ||
| <Box | ||
| is='button' | ||
| role='button' | ||
| onClick={onClick} | ||
| className={clickable} | ||
| aria-expanded={expanded} | ||
| aria-controls={_id} | ||
| display='flex' | ||
| flexDirection='row' | ||
| width='full' | ||
| focusable | ||
| color={Palette.text['font-default']} | ||
| > | ||
| <Chevron size={32} down={!expanded} up={expanded} style={{ alignSelf: 'flex-start' }} /> | ||
| <Box pb='x4' pi='x4' fontWeight='700'> | ||
| {children} | ||
| </Box> | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| }; |
18 changes: 18 additions & 0 deletions
18
...eor/client/views/marketplace/AppDetailsPage/tabs/AppLogs/Components/CollapsibleRegion.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Box } from '@rocket.chat/fuselage'; | ||
| import type { ComponentProps, ReactNode } from 'react'; | ||
|
|
||
| type CollapsibleRegionProps = { | ||
| children: ReactNode; | ||
| _id: string; | ||
| expanded?: boolean; | ||
| } & ComponentProps<typeof Box>; | ||
|
|
||
| export const CollapsibleRegion = ({ _id, children, expanded, ...props }: CollapsibleRegionProps) => { | ||
| return ( | ||
| <Box {...props} id={_id} maxHeight={expanded ? 'fit-content' : 0} style={{ transition: 'all 0.18s ease', overflowY: 'hidden' }} is='dd'> | ||
| <Box aria-labelledby={_id} role='region'> | ||
| {children} | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.