Skip to content

Commit

Permalink
Revert "[GLT-3976] added copy buttons for donor names and external na…
Browse files Browse the repository at this point in the history
…mes (#153)"

This reverts commit 0bca60c.
  • Loading branch information
wuall826 authored Sep 12, 2023
1 parent 0bca60c commit 6fca3f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 34 deletions.
1 change: 0 additions & 1 deletion changes/add_copyName-donor

This file was deleted.

21 changes: 8 additions & 13 deletions ts/data/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
} from "./requisition";
import { Tooltip } from "../component/tooltip";
import { caseFilters, latestActivitySort } from "../component/table-components";
import { makeCopyButton } from "../util/html-utils";

const dayMillis = 1000 * 60 * 60 * 24;

Expand Down Expand Up @@ -131,20 +130,16 @@ export const caseDefinition: TableDefinition<Case, Test> = {
title: "Donor",
sortType: "text",
addParentContents(kase, fragment) {
const nameDiv = makeNameDiv(
kase.donor.name,
urls.miso.sample(kase.donor.id),
urls.dimsum.donor(kase.donor.name),
kase.donor.name
fragment.appendChild(
makeNameDiv(
kase.donor.name,
urls.miso.sample(kase.donor.id),
urls.dimsum.donor(kase.donor.name)
)
);
fragment.appendChild(nameDiv);

const externalNameDiv = makeTextDivWithTooltip(
kase.donor.externalName,
"External Name",
true
fragment.appendChild(
makeTextDivWithTooltip(kase.donor.externalName, "External Name")
);
fragment.appendChild(externalNameDiv);

const tumourDetailDiv = document.createElement("div");
tumourDetailDiv.appendChild(
Expand Down
23 changes: 3 additions & 20 deletions ts/util/html-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,30 +157,13 @@ export function makeCopyButton(text: string): HTMLButtonElement {
return button;
}

export function makeTextDivWithTooltip(
text: string,
tooltip: string,
addCopyButton = false
) {
export function makeTextDivWithTooltip(text: string, tooltip: string) {
const div = document.createElement("div");
div.className = "flex flex-row space-x-1 items-center";
const textSpan = document.createElement("span");
textSpan.appendChild(document.createTextNode(text));

if (addCopyButton) {
const copyButton = makeCopyButton(text);
copyButton.classList.add("text-12");
div.appendChild(textSpan);
div.appendChild(copyButton);
} else {
div.appendChild(textSpan);
}

div.appendChild(document.createTextNode(text));
const tooltipInstance = Tooltip.getInstance();
const addContents = (fragment: DocumentFragment) =>
fragment.appendChild(document.createTextNode(tooltip));
tooltipInstance.addTarget(textSpan, addContents);

tooltipInstance.addTarget(div, addContents);
return div;
}

Expand Down

0 comments on commit 6fca3f5

Please sign in to comment.