added edit page and revised edit form
This commit is contained in:
@@ -1,28 +1,9 @@
|
||||
<script>
|
||||
import { flagEmoji } from '../shared/countries.js';
|
||||
|
||||
/** @type {{ entry: import('../stores/journalStore.js').JournalEntry, onClick: () => void }} */
|
||||
let { entry, onClick } = $props();
|
||||
|
||||
/** Convert country name to flag emoji via ISO 3166-1 alpha-2 */
|
||||
const countryCodeMap = {
|
||||
'Japan': 'JP', 'France': 'FR', 'Spain': 'ES', 'USA': 'US',
|
||||
'Thailand': 'TH', 'Germany': 'DE', 'Italy': 'IT', 'UK': 'GB',
|
||||
'Australia': 'AU', 'Canada': 'CA', 'China': 'CN', 'India': 'IN',
|
||||
'Brazil': 'BR', 'Mexico': 'MX', 'Portugal': 'PT', 'Netherlands': 'NL',
|
||||
'Greece': 'GR', 'Turkey': 'TR', 'Vietnam': 'VN', 'Indonesia': 'ID',
|
||||
'Malaysia': 'MY', 'Singapore': 'SG', 'South Korea': 'KR', 'Taiwan': 'TW',
|
||||
'New Zealand': 'NZ', 'Argentina': 'AR', 'Chile': 'CL', 'Peru': 'PE',
|
||||
'Morocco': 'MA', 'Egypt': 'EG', 'Kenya': 'KE', 'South Africa': 'ZA',
|
||||
'Sweden': 'SE', 'Norway': 'NO', 'Denmark': 'DK', 'Finland': 'FI',
|
||||
'Switzerland': 'CH', 'Austria': 'AT', 'Belgium': 'BE', 'Poland': 'PL',
|
||||
'Czech Republic': 'CZ', 'Hungary': 'HU', 'Croatia': 'HR',
|
||||
};
|
||||
|
||||
function flagEmoji(country) {
|
||||
const code = countryCodeMap[country];
|
||||
if (!code) return '';
|
||||
return [...code].map(c => String.fromCodePoint(0x1F1E6 - 65 + c.charCodeAt(0))).join('');
|
||||
}
|
||||
|
||||
function formatDate(/** @type {string} */ iso) {
|
||||
return new Date(iso).toLocaleDateString('en-US', {
|
||||
month: 'short', day: 'numeric', year: 'numeric',
|
||||
|
||||
Reference in New Issue
Block a user