diff --git a/package.json b/package.json index 03e1a45..86b37db 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "@fontsource/sen": "^5.0.15", "solid-icons": "^1.0.12", "solid-js": "^1.8.1", + "solid-toast": "^0.5.0", "temporal-polyfill": "^0.1.1" }, "license": "MIT", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bba2e81..93b2da9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ dependencies: solid-js: specifier: ^1.8.1 version: 1.8.1 + solid-toast: + specifier: ^0.5.0 + version: 0.5.0(solid-js@1.8.1) temporal-polyfill: specifier: ^0.1.1 version: 0.1.1 @@ -4911,6 +4914,14 @@ packages: solid-js: 1.8.1 dev: true + /solid-toast@0.5.0(solid-js@1.8.1): + resolution: {integrity: sha512-t770JakjyS2P9b8Qa1zMLOD51KYKWXbTAyJePVUoYex5c5FH5S/HtUBUbZAWFcqRCKmAE8KhyIiCvDZA8bOnxQ==} + peerDependencies: + solid-js: ^1.5.4 + dependencies: + solid-js: 1.8.1 + dev: false + /source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} diff --git a/src/Countdown.tsx b/src/Countdown.tsx index a428f48..fe359f8 100644 --- a/src/Countdown.tsx +++ b/src/Countdown.tsx @@ -1,6 +1,7 @@ import { createSignal, onCleanup } from "solid-js"; import { Temporal } from "temporal-polyfill"; import { IoSettingsSharp } from "solid-icons/io"; +import toast, { Toaster } from "solid-toast"; import FONT_FAMILY from "./font"; import { GIT_HASH } from "./config"; import { calculateAgeLocal } from "./calculate-age"; @@ -34,6 +35,15 @@ export default ({ const largeAge = () => Math.floor(age()).toString(); const smallAge = () => age().toFixed(11).split(".")[1]; + const copyAgeToClipboard = async () => { + const ageString = `${largeAge()}.${smallAge()}`; + try { + await navigator.clipboard.writeText(ageString); + toast.success("Age copied to clipboard!"); + } catch (err) { + toast.error("Failed to copy age to clipboard!"); + } + }; return (
+
-
Age
+
Age