Fix: copy button was storing literal template string
Nix Flake Check / Nix Flake Check (push) Successful in 1m30s
Build and Test / Build and Test (push) Successful in 7m42s

HEEX doesn't interpolate {} inside quoted attribute values.
Use data-token attribute + .dataset.token instead.
This commit is contained in:
2026-07-04 18:06:54 +00:00
parent 049773ab34
commit fc39a7df6c
2 changed files with 32 additions and 3 deletions
Generated
+27
View File
@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1782959384,
"narHash": "sha256-xnJJk+ct+D2+wdRxj1wk36w5zV9RVESwRqcklPdt3fM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "65179426c83bb3f6bc14898b42ea1c6f01d374b0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
@@ -38,10 +38,11 @@
<div class="mt-4" x-data="{ revealed: false, copied: false }"> <div class="mt-4" x-data="{ revealed: false, copied: false }">
<%= if Settings.get!(:api_token) do %> <%= if Settings.get!(:api_token) do %>
<% token = Settings.get!(:api_token) %>
<div class="flex items-center gap-3 flex-wrap"> <div class="flex items-center gap-3 flex-wrap">
<code class="font-mono text-sm bg-meta-2 dark:bg-meta-4 px-3 py-2 rounded break-all"> <code class="font-mono text-sm bg-meta-2 dark:bg-meta-4 px-3 py-2 rounded break-all">
<span x-show="!revealed">{String.slice(Settings.get!(:api_token), 0, 12)}••••••••</span> <span x-show="!revealed">{String.slice(token, 0, 12)}••••••••</span>
<span x-show="revealed" x-cloak>{Settings.get!(:api_token)}</span> <span x-show="revealed" x-cloak>{token}</span>
</code> </code>
<button type="button" class="text-sm underline" @click="revealed = !revealed"> <button type="button" class="text-sm underline" @click="revealed = !revealed">
<span x-show="!revealed">Show</span> <span x-show="!revealed">Show</span>
@@ -50,7 +51,8 @@
<button <button
type="button" type="button"
class="text-sm underline" class="text-sm underline"
@click="navigator.clipboard.writeText('{Settings.get!(:api_token)}').then(() => { copied = true; setTimeout(() => copied = false, 2000) })" data-token={token}
@click="navigator.clipboard.writeText($el.dataset.token).then(() => { copied = true; setTimeout(() => copied = false, 2000) })"
> >
<span x-show="!copied">Copy</span> <span x-show="!copied">Copy</span>
<span x-show="copied" x-cloak>Copied!</span> <span x-show="copied" x-cloak>Copied!</span>