Skip to content

Commit

Permalink
fix external links softlocking the ui in testing store cta
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Sep 2, 2024
1 parent a6e4bcf commit d064948
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
16 changes: 16 additions & 0 deletions frontend/src/components/ExternalLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Navigation } from '@decky/ui';
import { AnchorHTMLAttributes, FC } from 'react';

const ExternalLink: FC<AnchorHTMLAttributes<HTMLAnchorElement>> = (props) => {
return (
<a
{...props}
onClick={(e) => {
e.preventDefault();
props.onClick ? props.onClick(e) : props.href && Navigation.NavigateToExternalWeb(props.href);
}}
/>
);
};

export default ExternalLink;
5 changes: 3 additions & 2 deletions frontend/src/components/store/PluginCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';

import { InstallType } from '../../plugin';
import { StorePlugin, StorePluginVersion, requestPluginInstall } from '../../store';
import ExternalLink from '../ExternalLink';

interface PluginCardProps {
plugin: StorePlugin;
Expand Down Expand Up @@ -108,7 +109,7 @@ const PluginCard: FC<PluginCardProps> = ({ plugin }) => {
}}
>
<i>{t('PluginCard.plugin_full_access')}</i>{' '}
<a
<ExternalLink
className="deckyStoreCardDescriptionRootLink"
href="https://deckbrew.xyz/root"
target="_blank"
Expand All @@ -118,7 +119,7 @@ const PluginCard: FC<PluginCardProps> = ({ plugin }) => {
}}
>
deckbrew.xyz/root
</a>
</ExternalLink>
</div>
)}
</div>
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/components/store/Store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useTranslation } from 'react-i18next';
import logo from '../../../assets/plugin_store.png';
import Logger from '../../logger';
import { SortDirections, SortOptions, Store, StorePlugin, getPluginList, getStore } from '../../store';
import ExternalLink from '../ExternalLink';
import PluginCard from './PluginCard';

const logger = new Logger('Store');
Expand Down Expand Up @@ -207,15 +208,15 @@ const BrowseTab: FC<{ setPluginCount: Dispatch<SetStateAction<number | null>> }>
<h2 style={{ margin: 0 }}>{t('Store.store_testing_warning.label')}</h2>
<span>
{`${t('Store.store_testing_warning.desc')} `}
<a
<ExternalLink
href="https://decky.xyz/testing"
target="_blank"
style={{
textDecoration: 'none',
}}
>
decky.xyz/testing
</a>
</ExternalLink>
</span>
</div>
)}
Expand Down Expand Up @@ -269,15 +270,15 @@ const AboutTab: FC<{}> = () => {
<span className="deckyStoreAboutHeader">Testing</span>
<span>
{t('Store.store_testing_cta')}{' '}
<a
<ExternalLink
href="https://decky.xyz/testing"
target="_blank"
style={{
textDecoration: 'none',
}}
>
decky.xyz/testing
</a>
</ExternalLink>
</span>
<span className="deckyStoreAboutHeader">{t('Store.store_contrib.label')}</span>
<span>{t('Store.store_contrib.desc')}</span>
Expand Down

0 comments on commit d064948

Please sign in to comment.