Skip to content

Commit

Permalink
Add FileInvoice icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefwint committed Jan 30, 2024
1 parent 04f7ebb commit 919ea10
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 24 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"type": "module",
"dependencies": {
"@headlessui/react": "^1.7.17",
"@pzh-ui/components": "^0.0.452",
"@pzh-ui/components": "^0.0.463",
"@pzh-ui/config": "^0.0.56",
"@pzh-ui/css": "^0.0.75",
"@pzh-ui/icons": "^0.0.47",
"@pzh-ui/css": "^0.0.79",
"@pzh-ui/icons": "^0.0.50",
"@react-hookz/web": "^24.0.2",
"@tanstack/react-query": "^5.14.2",
"axios": "^1.6.2",
Expand Down
6 changes: 3 additions & 3 deletions src/App/Routes/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ const AppRoutes = () => {
element: (
<ProtectedRoute
permissions={{
canCreateUser: true,
canCreatePublicationTemplates: true,
}}
redirectTo="/muteer">
<PublicationTemplateOverview />
Expand All @@ -405,7 +405,7 @@ const AppRoutes = () => {
element: (
<ProtectedRoute
permissions={{
canCreateUser: true,
canCreatePublicationTemplates: true,
}}
redirectTo="/muteer">
<PublicationTemplateEdit />
Expand All @@ -417,7 +417,7 @@ const AppRoutes = () => {
element: (
<ProtectedRoute
permissions={{
canCreateUser: true,
canCreatePublicationTemplates: true,
}}
redirectTo="/muteer">
<PublicationTemplateCreate />
Expand Down
15 changes: 13 additions & 2 deletions src/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Text } from '@pzh-ui/components'
import { House, Users } from '@pzh-ui/icons'
import { FileInvoice, House, Users } from '@pzh-ui/icons'
import classNames from 'classnames'
import { useState } from 'react'
import { Link } from 'react-router-dom'
Expand All @@ -9,7 +9,7 @@ import { ModelType } from '@/config/objects/types'
import usePermissions from '@/hooks/usePermissions'

const Sidebar = () => {
const { canEditUser } = usePermissions()
const { canEditUser, canCreatePublicationTemplates } = usePermissions()

const [expanded, setExpanded] = useState(false)

Expand Down Expand Up @@ -91,6 +91,17 @@ const Sidebar = () => {
/>
</>
)}

{canCreatePublicationTemplates && (
<MenuItem
name="Publicatietemplates"
path="/muteer/publicatietemplates"
icon={FileInvoice}
expanded={expanded}
onHover={endAndStartTimer}
onClick={() => window.clearTimeout(timer)}
/>
)}
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/usePermissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface Permissions {
canCreateUser: boolean
canEditUser: boolean
canResetUserPassword: boolean
canCreatePublicationTemplates: boolean
}

const usePermissions = (): Permissions => {
Expand All @@ -29,6 +30,7 @@ const usePermissions = (): Permissions => {
canCreateUser: false,
canEditUser: false,
canResetUserPassword: false,
canCreatePublicationTemplates: false,
}

switch (role) {
Expand All @@ -51,6 +53,7 @@ const usePermissions = (): Permissions => {
canCreateUser: true,
canEditUser: true,
canResetUserPassword: true,
canCreatePublicationTemplates: true,
}
case 'Behandelend Ambtenaar':
return {
Expand Down
32 changes: 16 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2479,13 +2479,13 @@ __metadata:
languageName: node
linkType: hard

"@pzh-ui/components@npm:^0.0.452":
version: 0.0.452
resolution: "@pzh-ui/components@npm:0.0.452"
"@pzh-ui/components@npm:^0.0.463":
version: 0.0.463
resolution: "@pzh-ui/components@npm:0.0.463"
dependencies:
"@floating-ui/react": "npm:^0.24.8"
"@headlessui/react": "npm:^1.5.0"
"@pzh-ui/icons": "npm:^0.0.47"
"@pzh-ui/icons": "npm:^0.0.50"
"@react-aria/utils": "npm:^3.19.0"
"@react-hookz/web": "npm:^23.1.0"
"@react-types/shared": "npm:^3.19.0"
Expand Down Expand Up @@ -2531,7 +2531,7 @@ __metadata:
react-stately: "npm:^3.18.0"
react-table: "npm:^7.8.0"
react-toastify: "npm:^9.1.2"
checksum: 63dcd0d4e425dee788102bec43f5d4899843fe81c0961d8d0f9e238e23cce738868e152a42491f03f91a61b1b2dccbe0fee9740b29a815f692cc02eb64d4f7dc
checksum: c7afdde70501bc6ff443757fc0b6d8f15adf7f91c8d2cd3bfa80c9086773562f5b19a2890b86425243a6691f0d042f332fd43881324676cf0d9acd5ddf61f8f8
languageName: node
linkType: hard

Expand Down Expand Up @@ -2563,9 +2563,9 @@ __metadata:
languageName: node
linkType: hard

"@pzh-ui/css@npm:^0.0.75":
version: 0.0.75
resolution: "@pzh-ui/css@npm:0.0.75"
"@pzh-ui/css@npm:^0.0.79":
version: 0.0.79
resolution: "@pzh-ui/css@npm:0.0.79"
dependencies:
"@rollup/plugin-typescript": "npm:^8.3.1"
"@tailwindcss/custom-forms": "npm:^0.2.1"
Expand All @@ -2574,17 +2574,17 @@ __metadata:
"@tailwindcss/typography": "npm:^0.5.9"
react-datepicker: "npm:^4.7.0"
react-toastify: "npm:^9.1.2"
checksum: 98534c48dbaafe7f7a0c2b2cb5e57c374763e4279b1882f29cd094744fd5f2c827adfc53a60cdcde4524a70451d4a0021fa761133633c29492ba5a586f131358
checksum: 65f08cd2a33108adf63a83cbe680f6f72733385cff6608d082a7c47d93f5457cb595a15d90c8057553877737be658a21c670ca1693f96a8595c03da232b00614
languageName: node
linkType: hard

"@pzh-ui/icons@npm:^0.0.47":
version: 0.0.47
resolution: "@pzh-ui/icons@npm:0.0.47"
"@pzh-ui/icons@npm:^0.0.50":
version: 0.0.50
resolution: "@pzh-ui/icons@npm:0.0.50"
dependencies:
react: "npm:^18.0.0"
react-toastify: "npm:^9.1.2"
checksum: 1d677dd9d1d36cf9608d2778fcf1efff423e9c2e1fc0324d750b7c1541c3aca3e61cf459810aa300d9d4fde0ebd8fe8526ec852a22f8f9a8987ab7758f18f4ca
checksum: a94a31decee8c7d314e8befbd4139875700729c136704c4f49c1ccad4dc4e1f2190af5f794d98a27b7479b21fea8c7b7b0fda1bd319d1374b34e6defc2f119de
languageName: node
linkType: hard

Expand Down Expand Up @@ -12375,10 +12375,10 @@ __metadata:
"@axe-core/react": "npm:^4.8.2"
"@faker-js/faker": "npm:^8.3.1"
"@headlessui/react": "npm:^1.7.17"
"@pzh-ui/components": "npm:^0.0.452"
"@pzh-ui/components": "npm:^0.0.463"
"@pzh-ui/config": "npm:^0.0.56"
"@pzh-ui/css": "npm:^0.0.75"
"@pzh-ui/icons": "npm:^0.0.47"
"@pzh-ui/css": "npm:^0.0.79"
"@pzh-ui/icons": "npm:^0.0.50"
"@react-hookz/web": "npm:^24.0.2"
"@tanstack/react-query": "npm:^5.14.2"
"@testing-library/dom": "npm:^9.3.3"
Expand Down

0 comments on commit 919ea10

Please sign in to comment.