chore: change link text to "generated by" if in preview (#146)
This commit is contained in:
@@ -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 <></>;
|
||||
|
||||
@@ -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 && (
|
||||
|
||||
Reference in New Issue
Block a user