Skip to content

Commit

Permalink
fix(ShortcutLink): Using a flag instead of a context
Browse files Browse the repository at this point in the history
  • Loading branch information
cballevre committed Nov 20, 2024
1 parent ac64e0f commit c4c4674
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/ShortcutLink.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react'
import get from 'lodash/get'

import { useClient, useFetchShortcut, useInstanceInfo } from 'cozy-client'
import { useClient, useFetchShortcut } from 'cozy-client'
import { CozyFile } from 'cozy-doctypes'
import flag from 'cozy-flags'

import SquareAppIcon from 'cozy-ui/transpiled/react/SquareAppIcon'
import Link from 'cozy-ui/transpiled/react/Link'
Expand All @@ -22,7 +23,6 @@ export const ShortcutLink = ({
// waiting an http request to resolve.
const { shortcutInfos } = useFetchShortcut(client, file._id)
const { isMobile } = useBreakpoints()
const instanceInfo = useInstanceInfo()

const computedSize = isMobile ? 32 : desktopSize
const { filename } = CozyFile.splitFilename(file)
Expand All @@ -35,8 +35,6 @@ export const ShortcutLink = ({
const icon = get(file, 'attributes.metadata.icon')
const iconMimeType = get(file, 'attributes.metadata.iconMimeType')
const description = get(file, 'attributes.metadata.description')
const shouldShortcutBadgeHidden =
instanceInfo.context?.data?.hide_shortcut_badge_on_home ?? false

return (
<Link
Expand Down Expand Up @@ -65,15 +63,15 @@ export const ShortcutLink = ({
alt={filename}
/>
}
hideShortcutBadge={shouldShortcutBadgeHidden}
hideShortcutBadge={flag('home.hide-shortcut-badge')}
/>
) : (
<SquareAppIcon
name={filename}
variant="shortcut"
display={display}
description={description}
hideShortcutBadge={shouldShortcutBadgeHidden}
hideShortcutBadge={flag('home.hide-shortcut-badge')}
/>
)}
</Link>
Expand Down

0 comments on commit c4c4674

Please sign in to comment.