feat: static city suggestions by country, fix city dropdown, coloring animation on save

This commit is contained in:
haerikimmm
2026-06-16 19:21:26 +09:00
parent a7079c1f18
commit c7cf053105
4 changed files with 227 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
import * as d3 from 'd3';
import { feature } from 'topojson-client';
import worldData from 'world-atlas/countries-50m.json';
import { getSelected, setTotalCount } from '../layout/selection.svelte.js';
import { getSelected, setTotalCount, getFlashing } from '../layout/selection.svelte.js';
import { getUserProfile } from '../auth/userStore.svelte.js';
import homeIconUrl from '../../assets 2/home.png';
import crayonCursorUrl from '../../assets/logo-cursor.png';
@@ -76,7 +76,7 @@
}
let frameEl;
let _paths = null;
let _paths = $state(null);
let _g = null;
let _pathFn = null;
let _countries = null;
@@ -120,6 +120,23 @@
$effect(updateAllFills);
$effect(() => {
const flashSet = getFlashing();
const paths = _paths; // reactive read so effect re-runs when _paths is set
if (!paths || flashSet.size === 0) return;
paths
.filter(d => flashSet.has(effId(d)))
.each(function() {
d3.select(this).interrupt()
.transition().duration(200).attr('fill', '#facc15')
.transition().duration(200).attr('fill', '#fb923c')
.transition().duration(200).attr('fill', '#facc15')
.transition().duration(200).attr('fill', '#fb923c')
.transition().duration(200).attr('fill', '#facc15')
.transition().duration(400).attr('fill', VISITED_COLOR);
});
});
onMount(() => {
const width = frameEl.clientWidth;
const height = frameEl.clientHeight;