refactor(checksum): streamline checksum handling and improve UI transitions

- Removed GITHUB_TOKEN from workflow as it's no longer needed.
- Enhanced ButtonCard component with smoother transitions for checksum display.
- Cleaned up unused styles related to checksum interactions.
This commit is contained in:
taroj1205 2025-05-09 12:19:35 +12:00
parent 3816206f6b
commit 79d4aeb39b
No known key found for this signature in database
GPG key ID: 0FCB6CFFE0981AB7
3 changed files with 3 additions and 25 deletions

View file

@ -23,5 +23,3 @@ jobs:
- name: Build project - name: Build project
run: npm run build run: npm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -23,7 +23,7 @@ const { label, href, checksum } = Astro.props
<span class="group/checksum relative hidden items-center md:flex"> <span class="group/checksum relative hidden items-center md:flex">
<button <button
type="button" type="button"
class="checksum-icon-btn text-muted-foreground flex items-center justify-center rounded-full p-1 hover:text-coral focus:outline-none focus:ring-2 focus:ring-coral data-[twilight='true']:hover:text-zen-blue data-[twilight='true']:focus:ring-zen-blue" class="checksum-icon-btn text-muted-foreground flex items-center justify-center rounded-full p-1 transition-colors duration-150 hover:text-coral focus:outline-none focus:ring-2 focus:ring-coral data-[twilight='true']:hover:text-zen-blue data-[twilight='true']:focus:ring-zen-blue"
aria-label="Show SHA-256 checksum" aria-label="Show SHA-256 checksum"
tabindex="0" tabindex="0"
> >
@ -41,10 +41,10 @@ const { label, href, checksum } = Astro.props
<path d="M9 12l2 2 4-4" /> <path d="M9 12l2 2 4-4" />
</svg> </svg>
</button> </button>
<span class="absolute -top-10 left-1/2 z-50 hidden min-w-[120px] -translate-x-1/2 select-none whitespace-nowrap rounded-md border border-subtle bg-[rgba(255,255,255,0.98)] px-3 py-2 text-xs text-gray-700 shadow group-focus-within/checksum:hidden group-hover/checksum:flex group-focus-within/checksum:group-hover/checksum:hidden dark:bg-[rgba(24,24,27,0.98)] dark:text-gray-100"> <span class="absolute -top-10 left-1/2 z-50 hidden min-w-[120px] -translate-x-1/2 select-none whitespace-nowrap rounded-md border border-subtle bg-[rgba(255,255,255,0.98)] px-3 py-2 text-xs text-gray-700 opacity-100 shadow transition-opacity duration-150 group-focus-within/checksum:hidden group-hover/checksum:flex group-focus-within/checksum:group-hover/checksum:hidden dark:bg-[rgba(24,24,27,0.98)] dark:text-gray-100">
Show SHA-256 Show SHA-256
</span> </span>
<span class="checksum-tooltip popover absolute -left-14 -top-12 z-50 hidden min-w-[220px] items-center gap-2 whitespace-nowrap rounded-md border border-subtle bg-[rgba(255,255,255,0.98)] px-3 py-2 text-xs text-gray-700 shadow group-focus-within/checksum:flex dark:bg-[rgba(24,24,27,0.98)] dark:text-gray-100"> <span class="checksum-tooltip popover absolute -left-14 -top-12 z-50 hidden min-w-[220px] items-center gap-2 whitespace-nowrap rounded-md border border-subtle bg-[rgba(255,255,255,0.98)] px-3 py-2 text-xs text-gray-700 opacity-100 shadow transition-opacity duration-150 group-focus-within/checksum:flex dark:bg-[rgba(24,24,27,0.98)] dark:text-gray-100">
<span class="flex-1 truncate font-mono text-xs">{checksum}</span> <span class="flex-1 truncate font-mono text-xs">{checksum}</span>
<button <button
type="button" type="button"
@ -87,22 +87,6 @@ const { label, href, checksum } = Astro.props
</a> </a>
</div> </div>
<style>
.checksum-expand {
transition: all 0.2s;
z-index: 100;
}
.checksum-icon-btn {
transition:
color 0.15s,
background 0.15s;
}
.checksum-tooltip {
transition: opacity 0.15s;
opacity: 1;
}
</style>
<script> <script>
const checksumButtons = document.querySelectorAll( const checksumButtons = document.querySelectorAll(
'.checksum-icon-btn', '.checksum-icon-btn',

View file

@ -3,13 +3,9 @@
* Returns a mapping from filename to checksum. * Returns a mapping from filename to checksum.
*/ */
export async function getChecksums() { export async function getChecksums() {
const token = import.meta.env.GITHUB_TOKEN;
if (!token) throw new Error('GITHUB_TOKEN is not set in environment variables');
const res = await fetch('https://api.github.com/repos/zen-browser/desktop/releases/latest', { const res = await fetch('https://api.github.com/repos/zen-browser/desktop/releases/latest', {
headers: { headers: {
'Accept': 'application/vnd.github+json', 'Accept': 'application/vnd.github+json',
'Authorization': `Bearer ${token}`,
'X-GitHub-Api-Version': '2022-11-28', 'X-GitHub-Api-Version': '2022-11-28',
'User-Agent': 'zen-browser-checksum-fetcher', 'User-Agent': 'zen-browser-checksum-fetcher',
}, },