Skip to content

Commit

Permalink
chore: change link text to "generated by" if in preview (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueBrain authored Jun 8, 2024
1 parent 03ac963 commit cc97781
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/components/ShipFit/FitLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { useExportEveShipFitHash } from "@/hooks/ExportEveShipFitHash";

import styles from "./ShipFit.module.css";

export const FitLink = () => {
export const FitLink = (props: { isPreview?: boolean }) => {
const link = useExportEveShipFitHash();
const { copy, copied } = useClipboard();

const isRemote = typeof window !== "undefined";

const linkText = isRemote ? "open on eveship.fit" : "share fit";
const linkText = props.isPreview ? "generated by eveship.fit" : isRemote ? "open on eveship.fit" : "share fit";
const linkPropsClick = React.useCallback(
(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
e.preventDefault();
Expand All @@ -22,7 +22,7 @@ export const FitLink = () => {
[copy, link],
);
const linkProps = {
onClick: isRemote ? undefined : linkPropsClick,
onClick: props.isPreview || isRemote ? undefined : linkPropsClick,
};

if (link === null) return <></>;
Expand Down
4 changes: 2 additions & 2 deletions src/components/ShipFit/ShipFit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import styles from "./ShipFit.module.css";
/**
* Render a ship fit similar to how it is done in-game.
*/
export const ShipFit = (props: { withStats?: boolean }) => {
export const ShipFit = (props: { withStats?: boolean; isPreview?: boolean }) => {
const eveData = useEveData();
const statistics = useStatistics();

Expand Down Expand Up @@ -55,7 +55,7 @@ export const ShipFit = (props: { withStats?: boolean }) => {
<RingInner />

<Hull />
<FitLink />
<FitLink isPreview={props.isPreview} />

<RingTop>
{props.withStats && (
Expand Down

0 comments on commit cc97781

Please sign in to comment.