Skip to content

Commit

Permalink
fix issues with the missing info icon
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-sz committed Nov 2, 2023
1 parent 9057093 commit aa8fd9b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 5 deletions.
2 changes: 1 addition & 1 deletion web/src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { useTranslation } from 'react-i18not';
import { Link } from 'wouter';
import { observer } from 'mobx-react-lite';
import clsx from 'clsx';

import styles from './Footer.module.scss';
import { Link } from './Link.js';
import { applicationStore } from '../stores/index.js';

export const Footer: React.FC = observer(() => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
IoInformationCircle,
IoLogoTwitter,
} from 'react-icons/io5';
import { Link } from 'wouter';
import { observer } from 'mobx-react-lite';

import styles from './Header.module.scss';
import { Link } from './Link.js';
import { DropIcon } from './DropIcon.js';
import { applicationStore } from '../stores/index.js';
import { SecureStatus } from './SecureStatus.js';
Expand Down
45 changes: 45 additions & 0 deletions web/src/components/Link.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, { forwardRef } from 'react';
import { useLocation, useRouter } from 'wouter';

interface LinkProps
extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
to: string;
}

export const Link: React.FC<LinkProps> = forwardRef<
HTMLAnchorElement,
LinkProps
>((props, ref) => {
const router = useRouter();
const [, navigate] = useLocation();

const { to, onClick, children, ...aProps } = props;

return (
<a
ref={ref}
{...aProps}
href={to[0] === '~' ? to.slice(1) : router.base + to}
onClick={event => {
// ignores the navigation when clicked using right mouse button or
// by holding a special modifier key: ctrl, command, win, alt, shift
if (
event.ctrlKey ||
event.metaKey ||
event.altKey ||
event.shiftKey ||
event.button !== 0
)
return;

onClick && onClick(event);
if (!event.defaultPrevented) {
event.preventDefault();
navigate(to);
}
}}
>
{children}
</a>
);
});
2 changes: 1 addition & 1 deletion web/src/screens/About.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'wouter';

import { Link } from '../components/Link.js';
import { TextSection } from '../components/TextSection.js';

export const About: React.FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/screens/Abuse.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Link } from 'wouter';
import { observer } from 'mobx-react-lite';

import { Link } from '../components/Link.js';
import { TextSection } from '../components/TextSection.js';
import { applicationStore } from '../stores/index.js';

Expand Down
2 changes: 1 addition & 1 deletion web/src/sections/LocalNetworks/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import clsx from 'clsx';
import { observer } from 'mobx-react-lite';
import { Link } from 'wouter';

import styles from './index.module.scss';
import { Link } from '../../components/Link.js';
import { applicationStore, networkStore } from '../../stores/index.js';
import { TargetTile } from '../../components/TargetTile.js';

Expand Down

0 comments on commit aa8fd9b

Please sign in to comment.