Skip to content

Commit

Permalink
Revert DeepLinks in favor of regular links.
Browse files Browse the repository at this point in the history
This component was originally added in 2017 to deep link to native
Sheets/Docs apps when installed on mobile devices. On reasonably modern
devices, regular HTTP links should be intercepted by native apps when
present, so no special machinery is needed.

Fixes deathandmayhem#1963
Fixes deathandmayhem#2282
  • Loading branch information
jpd236 committed Oct 22, 2024
1 parent 0a8dbc0 commit a5bac0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 89 deletions.
80 changes: 0 additions & 80 deletions imports/client/components/DeepLink.tsx

This file was deleted.

12 changes: 3 additions & 9 deletions imports/client/components/DocumentDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import React from "react";
import styled from "styled-components";
import type { DocumentType } from "../../lib/models/Documents";
import DeepLink from "./DeepLink";

interface DocumentDisplayProps {
document: DocumentType;
displayMode: "link" | "embed";
}

const StyledDeepLink = styled(DeepLink)`
const StyledDeepLink = styled.a`
display: inline-block;
font-weight: bold;
white-space: nowrap;
Expand Down Expand Up @@ -46,19 +45,16 @@ const GoogleDocumentDisplay = ({
displayMode,
}: DocumentDisplayProps) => {
let url: string;
let deepUrl: string;
let title: string;
let icon: IconDefinition;
switch (document.value.type) {
case "spreadsheet":
url = `https://docs.google.com/spreadsheets/d/${document.value.id}/edit?ui=2&rm=embedded&gid=0#gid=0`;
deepUrl = `googlesheets://${url}`;
title = "Sheet";
icon = faTable;
break;
case "document":
url = `https://docs.google.com/document/d/${document.value.id}/edit?ui=2&rm=embedded#gid=0`;
deepUrl = `googledocs://${url}`;
title = "Doc";
icon = faFileAlt;
break;
Expand All @@ -74,10 +70,8 @@ const GoogleDocumentDisplay = ({
switch (displayMode) {
case "link":
return (
<StyledDeepLink nativeUrl={deepUrl} browserUrl={url}>
<a href={url} target="new">
<FontAwesomeIcon fixedWidth icon={icon} /> <span>{title}</span>
</a>
<StyledDeepLink href={url} target="_blank" rel="noreferrer noopener">
<FontAwesomeIcon fixedWidth icon={icon} /> <span>{title}</span>
</StyledDeepLink>
);
case "embed":
Expand Down

0 comments on commit a5bac0c

Please sign in to comment.