Skip to content

Commit

Permalink
Merge pull request #846 from aliraza556/add-item-menu-list
Browse files Browse the repository at this point in the history
Add New `Add Item` Menu List Item to Main Toolbar
  • Loading branch information
Rassl authored Jan 31, 2024
2 parents abc75f2 + c79a06c commit 54d2b94
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/App/MainToolbar/__test__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('MainToolbar Component Tests', () => {
it('renders MainToolbar component with correct elements', () => {
render(<MainToolbar />)

expect(screen.getByText('Add Item')).toBeInTheDocument()
expect(screen.getByText('Add Content')).toBeInTheDocument()
expect(screen.getByText('Source Table')).toBeInTheDocument()
expect(screen.getByText('Settings')).toBeInTheDocument()
Expand Down
12 changes: 12 additions & 0 deletions src/components/App/MainToolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { colors } from '~/utils/colors'

export const MainToolbar = () => {
const { open: openSourcesModal } = useModal('sourcesTable')
const { open: openItemAddModal } = useModal('addItem')
const { open: openContentAddModal } = useModal('addContent')
const { open: openSettingsModal } = useModal('settings')

Expand All @@ -17,6 +18,17 @@ export const MainToolbar = () => {
<LogoButton>
<img alt="Second brain" src="logo.svg" />
</LogoButton>
<ActionButton
data-testid="add-item-modal"
onClick={() => {
openItemAddModal
}}
>
<IconWrapper>
<AddContentIcon />
</IconWrapper>
<Text>Add Item</Text>
</ActionButton>
<ActionButton data-testid="add-content-modal" onClick={openContentAddModal}>
<IconWrapper>
<AddContentIcon />
Expand Down
2 changes: 2 additions & 0 deletions src/stores/useModalStore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { create } from 'zustand'
export type AvailableModals =
| 'budgetExplanation'
| 'sourcesTable'
| 'addItem'
| 'addContent'
| 'editTopic'
| 'addEdge'
Expand All @@ -22,6 +23,7 @@ const defaultData = {
currentModals: {
budgetExplanation: false,
sourcesTable: false,
addItem: false,
addContent: false,
editTopic: false,
addEdge: false,
Expand Down

0 comments on commit 54d2b94

Please sign in to comment.