-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add component sidebar manage tab
- Loading branch information
Showing
17 changed files
with
437 additions
and
193 deletions.
There are no files selected for viewing
This file contains 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
1 change: 0 additions & 1 deletion
1
src/library-authoring/component-info/ComponentInfoHeader.test.tsx
This file contains 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
18 changes: 18 additions & 0 deletions
18
src/library-authoring/component-info/ComponentManagement.test.tsx
This file contains 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 { | ||
initializeMocks, | ||
render, | ||
screen, | ||
} from '../../testUtils'; | ||
import { mockLibraryBlockMetadata } from '../data/api.mocks'; | ||
import ComponentManagement from './ComponentManagement'; | ||
|
||
describe('<ComponentManagement />', () => { | ||
it('should render draft status', async () => { | ||
initializeMocks(); | ||
mockLibraryBlockMetadata.applyMock(); | ||
render(<ComponentManagement usageKey={mockLibraryBlockMetadata.usageKeyNeverPublished} />); | ||
expect(await screen.findByText('Draft')).toBeInTheDocument(); | ||
expect(screen.queryByText('Draft(Never Published)')).not.toBeInTheDocument(); | ||
expect(screen.queryByText('Draft saved on June 20, 2024 at 13:54 UTC.)')).not.toBeInTheDocument(); | ||
}); | ||
}); |
57 changes: 57 additions & 0 deletions
57
src/library-authoring/component-info/ComponentManagement.tsx
This file contains 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,57 @@ | ||
import { getConfig } from '@edx/frontend-platform'; | ||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
import { Collapsible, Icon, Stack } from '@openedx/paragon'; | ||
import { Tag } from '@openedx/paragon/icons'; | ||
|
||
import { useLibraryBlockMetadata } from '../data/apiHooks'; | ||
import StatusWidget from '../generic/status-widget'; | ||
import messages from './messages'; | ||
|
||
interface ComponentManagementProps { | ||
usageKey: string; | ||
} | ||
const ComponentManagement = ({ usageKey }: ComponentManagementProps) => { | ||
const intl = useIntl(); | ||
const { data: componentMetadata } = useLibraryBlockMetadata(usageKey); | ||
|
||
if (!componentMetadata) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Stack gap={3}> | ||
<StatusWidget | ||
{...componentMetadata} | ||
/> | ||
{[true, 'true'].includes(getConfig().ENABLE_TAGGING_TAXONOMY_PAGES) | ||
&& ( | ||
<Collapsible | ||
defaultOpen | ||
title={( | ||
<Stack gap={1} direction="horizontal"> | ||
<Icon src={Tag} /> | ||
{intl.formatMessage(messages.manageTabTagsTitle)} | ||
</Stack> | ||
)} | ||
className="border-0" | ||
> | ||
Tags placeholder | ||
</Collapsible> | ||
)} | ||
<Collapsible | ||
defaultOpen | ||
title={( | ||
<Stack gap={1} direction="horizontal"> | ||
<Icon src={Tag} /> | ||
{intl.formatMessage(messages.manageTabCollectionsTitle)} | ||
</Stack> | ||
)} | ||
className="border-0" | ||
> | ||
Collections placeholder | ||
</Collapsible> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default ComponentManagement; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 @@ | ||
@import "./status-widget/StatusWidget"; |
This file contains 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
Oops, something went wrong.