Skip to content
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

[VO-1194] fix(ShortcutLink): Using a flag instead of a context #2251

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading