chore: change link text to "generated by" if in preview (#146)

This commit is contained in:
Patric Stout
2024-06-08 10:55:40 +02:00
committed by GitHub
parent 03ac9634f7
commit cc97781fb3
2 changed files with 5 additions and 5 deletions

View File

@@ -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();
@@ -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 <></>;

View File

@@ -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();
@@ -55,7 +55,7 @@ export const ShipFit = (props: { withStats?: boolean }) => {
<RingInner />
<Hull />
<FitLink />
<FitLink isPreview={props.isPreview} />
<RingTop>
{props.withStats && (