Fixing share link

This commit is contained in:
2025-07-06 15:33:35 +02:00
parent 3a5b38bd70
commit bf5085431a
14 changed files with 182 additions and 112 deletions

View File

@ -60,17 +60,24 @@ export function TopBar() {
uiOpacity: settings.uiOpacity,
};
const encoded = btoa(JSON.stringify(shareData));
window.location.hash = encoded;
try {
const encoded = btoa(JSON.stringify(shareData));
const url = `${window.location.origin}${window.location.pathname}#${encoded}`;
navigator.clipboard
.writeText(window.location.href)
.then(() => {
console.log('URL copied to clipboard');
})
.catch(() => {
console.log('Copy failed');
});
console.log('Sharing URL:', url);
console.log('Share data:', shareData);
navigator.clipboard
.writeText(url)
.then(() => {
console.log('URL copied to clipboard');
})
.catch(() => {
console.log('Copy failed');
});
} catch (error) {
console.error('Failed to create share URL:', error);
}
};
const handleExportPNG = () => {
@ -151,7 +158,9 @@ export function TopBar() {
Value Mode:
<select
value={settings.valueMode}
onChange={(e) => updateAppSettings({ valueMode: e.target.value as ValueMode })}
onChange={(e) =>
updateAppSettings({ valueMode: e.target.value as ValueMode })
}
style={{
background: 'rgba(255,255,255,0.1)',
border: '1px solid #555',