extremely claude-assisted go game based on atproto! working on cleaning up and giving a more unique design, still has a bit of a slop vibe to it.
Something went wrong. Try again.
8.0 kB · 285 lines
Svelte
at master
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286<script lang="ts"> import { onMount } from 'svelte'; import { browser } from '$app/environment'; import proverbs from '$lib/go-proverbs.json';
let isDismissed = $state(false); let proverb = $state<{ text: string; url: string; category: string } | null>(null);
function getDailyProverb() { // Use the current date as a seed to get the same proverb all day const today = new Date(); const dayOfYear = Math.floor((today.getTime() - new Date(today.getFullYear(), 0, 0).getTime()) / 86400000); const index = dayOfYear % proverbs.length; return proverbs[index]; }
function getCookie(name: string): string | null { if (!browser) return null; const value = `; ${document.cookie}`; const parts = value.split(`; ${name}=`); if (parts.length === 2) return parts.pop()?.split(';').shift() || null; return null; }
function setCookie(name: string, value: string, days: number) { if (!browser) return; const expires = new Date(); expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000); document.cookie = `${name}=${value};expires=${expires.toUTCString()};path=/`; }
function dismiss() { isDismissed = true; const today = new Date().toISOString().split('T')[0]; setCookie('proverb-dismissed', today, 1); }
onMount(() => { proverb = getDailyProverb();
// Check if proverb was dismissed today const dismissedDate = getCookie('proverb-dismissed'); const today = new Date().toISOString().split('T')[0];
if (dismissedDate === today) { isDismissed = true; } });</script>
{#if proverb && !isDismissed} <div class="proverb-banner"> <div class="scroll"> <div class="scroll-top" aria-hidden="true"></div>
<div class="scroll-body"> <div class="scroll-content"> <div class="proverb-category">{proverb.category}</div> <a href={proverb.url} target="_blank" rel="noopener noreferrer" class="proverb-text"> "{proverb.text}" </a> <div class="proverb-hint">Click to learn more →</div> </div> <button class="dismiss-btn" onclick={dismiss} aria-label="Dismiss proverb"> ✕ </button> </div>
<div class="scroll-bottom" aria-hidden="true"></div> </div> </div>{/if}
<style> .proverb-banner { display: flex; justify-content: center; margin-bottom: 1.5rem; animation: unfurl 0.8s ease-out; position: relative; z-index: 50; }
@keyframes unfurl { from { opacity: 0; transform: translateY(-20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.scroll { position: relative;
width: 100%; display: flex; flex-direction: column; align-items: center; }
/* The rolled ends: a cylinder catching light along its length, with the spiral of the roll visible at each end. */ .scroll-top, .scroll-bottom { position: relative; z-index: 2; height: 22px; width: 104%; border-radius: 999px; background: linear-gradient( 180deg, #f7eeda 0%, #e6d7b6 16%, #cdb68c 46%, #b1966a 74%, #cdb994 92%, #e6d7b6 100% ); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -2px 3px rgba(90, 70, 40, 0.28), 0 2px 4px rgba(90, 70, 40, 0.3), 0 10px 20px -8px rgba(90, 70, 40, 0.4); }
.scroll-top { margin-bottom: -9px; } .scroll-bottom { margin-top: -9px; }
/* The cut end of the rolled sheet. Inset, so it reads as the end of the roll rather than a knob stuck on the outside of it. */ .scroll-top::before, .scroll-top::after, .scroll-bottom::before, .scroll-bottom::after { content: ''; position: absolute; top: 50%; width: 12px; height: 12px; transform: translateY(-50%); border-radius: 50%; background: radial-gradient( circle at 50% 50%, #c9b189 0%, #e2d2ae 34%, #cbb488 62%, #ab9166 100% ); box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45); }
.scroll-top::before, .scroll-bottom::before { left: 3px; } .scroll-top::after, .scroll-bottom::after { right: 3px; }
.scroll-body { position: relative; width: 100%; /* Aged papyrus: uneven tone, darker where the sheet is handled or stained */ background: radial-gradient(ellipse 60% 40% at 16% 24%, rgba(146, 118, 76, 0.13), transparent 62%), radial-gradient(ellipse 55% 45% at 84% 74%, rgba(146, 118, 76, 0.11), transparent 60%), radial-gradient(ellipse 45% 55% at 46% 88%, rgba(146, 118, 76, 0.09), transparent 58%), radial-gradient(ellipse 40% 38% at 68% 12%, rgba(255, 250, 238, 0.5), transparent 60%), linear-gradient(to right, #d9c49c 0%, #ecdcbc 5%, #f6ecd7 50%, #ecdcbc 95%, #d9c49c 100%); padding: 1.75rem 3rem 1.75rem 2.25rem; box-shadow: inset 0 12px 16px -14px rgba(90, 70, 40, 0.55), inset 0 -12px 16px -14px rgba(90, 70, 40, 0.55), inset 4px 0 8px -6px rgba(90, 70, 40, 0.35), inset -4px 0 8px -6px rgba(90, 70, 40, 0.35), 0 6px 16px rgba(90, 122, 144, 0.14); border-left: 1px solid rgba(186, 163, 122, 0.75); border-right: 1px solid rgba(186, 163, 122, 0.75); overflow: hidden; }
.scroll-body::before { content: ''; position: absolute; inset: 0; /* Papyrus is strips laid at right angles: fine fibres both ways, plus the coarser banding of the sheet. */ background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(139, 115, 85, 0.05) 2px 3px), repeating-linear-gradient(90deg, transparent 0 5px, rgba(139, 115, 85, 0.04) 5px 6px), repeating-linear-gradient(0deg, transparent 0 21px, rgba(139, 115, 85, 0.045) 21px 22px); mix-blend-mode: multiply; pointer-events: none; }
.scroll-body::after { content: ''; position: absolute; inset: 0; opacity: 0.6; mix-blend-mode: multiply; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.045 0.7' numOctaves='4' seed='7'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23p)' opacity='0.4'/></svg>"); background-size: 160px 160px; pointer-events: none; }
.scroll-content { position: relative; text-align: center; z-index: 1; }
.proverb-category { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: #8B7355; font-weight: 600; margin-bottom: 0.5rem; opacity: 0.7; }
.proverb-text { display: block; font-family: Georgia, 'Times New Roman', serif; font-size: 1.1rem; line-height: 1.6; color: #3a2f23; text-decoration: none; font-style: italic; transition: color 0.3s ease; margin-bottom: 0.25rem; }
.proverb-text:hover { color: var(--sky-apricot-dark); }
.proverb-hint { font-size: 0.7rem; color: #8B7355; opacity: 0; transition: opacity 0.3s ease; }
.proverb-text:hover + .proverb-hint, .scroll:hover .proverb-hint { opacity: 0.6; }
.dismiss-btn { position: absolute; top: 0.5rem; right: 0.5rem; background: rgba(139, 115, 85, 0.1); border: 1px solid rgba(139, 115, 85, 0.2); border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #8B7355; font-size: 0.9rem; transition: all 0.3s ease; z-index: 2; }
.dismiss-btn:hover { background: rgba(139, 115, 85, 0.2); border-color: rgba(139, 115, 85, 0.4); transform: rotate(90deg); }
@media (max-width: 640px) { .scroll-body { padding: 1.25rem 2.5rem 1.25rem 1.5rem; }
.proverb-text { font-size: 1rem; } }</style>