From 5be2bf0779fc8343bc2e59fc0afabbed7143cf7c Mon Sep 17 00:00:00 2001 From: Kitteh Date: Sun, 18 Apr 2021 10:56:23 +0100 Subject: [PATCH] Add copy token button, closes #9. --- src/pages/Home.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/pages/Home.js b/src/pages/Home.js index 682b555..f24add0 100644 --- a/src/pages/Home.js +++ b/src/pages/Home.js @@ -4,7 +4,7 @@ import { getAPIURL, getToken } from "../utils.js"; import { makeElement } from "../htmlUtils.js"; import { getSealStatus, lookupSelf, getMounts, renewSelf } from "../api.js"; import formatDistance from 'date-fns/formatDistance'; - +import ClipboardJS from "clipboard"; export class HomePage extends Page { constructor() { @@ -50,6 +50,19 @@ export class HomePage extends Page { } }) }), + makeElement({ + tag: "li", + children: makeElement({ + tag: "a", + text: "Copy Token", + attributes: { + "data-clipboard-text": getToken(), + }, + thenRun: (e) => { + new ClipboardJS(e); + } + }) + }), makeElement({ tag: "li", children: makeElement({