mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-24 18:13:20 +00:00
minor layout fix
This commit is contained in:
1 file changed
+41
-27
@@ -16,10 +16,7 @@
|
|||||||
import type { LiveSyncBaseCore } from "@/LiveSyncBaseCore";
|
import type { LiveSyncBaseCore } from "@/LiveSyncBaseCore";
|
||||||
import { ConnectionStringParser } from "@lib/common/ConnectionString";
|
import { ConnectionStringParser } from "@lib/common/ConnectionString";
|
||||||
import type { P2PSyncSetting, RemoteConfiguration } from "@lib/common/models/setting.type";
|
import type { P2PSyncSetting, RemoteConfiguration } from "@lib/common/models/setting.type";
|
||||||
import {
|
import { activateP2PRemoteConfiguration, createRemoteConfigurationId } from "@lib/serviceFeatures/remoteConfig";
|
||||||
activateP2PRemoteConfiguration,
|
|
||||||
createRemoteConfigurationId,
|
|
||||||
} from "@lib/serviceFeatures/remoteConfig";
|
|
||||||
import { extractP2PRoomSuffix } from "@lib/common/utils";
|
import { extractP2PRoomSuffix } from "@lib/common/utils";
|
||||||
import { SetupManager } from "@/modules/features/SetupManager";
|
import { SetupManager } from "@/modules/features/SetupManager";
|
||||||
import SetupRemoteP2P from "@/modules/features/SetupWizard/dialogs/SetupRemoteP2P.svelte";
|
import SetupRemoteP2P from "@/modules/features/SetupWizard/dialogs/SetupRemoteP2P.svelte";
|
||||||
@@ -36,9 +33,7 @@
|
|||||||
let replicatingPeerId = $state<string | null>(null);
|
let replicatingPeerId = $state<string | null>(null);
|
||||||
let communicatingUntil = $state<Record<string, number>>({});
|
let communicatingUntil = $state<Record<string, number>>({});
|
||||||
const COMMUNICATION_HOLD_MS = 2500;
|
const COMMUNICATION_HOLD_MS = 2500;
|
||||||
let syncOnReplicationSetting = $state(
|
let syncOnReplicationSetting = $state(core.services.setting.currentSettings()?.P2P_SyncOnReplication ?? "");
|
||||||
core.services.setting.currentSettings()?.P2P_SyncOnReplication ?? ""
|
|
||||||
);
|
|
||||||
type P2PRemoteOption = {
|
type P2PRemoteOption = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -51,12 +46,19 @@
|
|||||||
let selectingP2PRemote = $state(false);
|
let selectingP2PRemote = $state(false);
|
||||||
|
|
||||||
function addToList(item: string, list: string): string {
|
function addToList(item: string, list: string): string {
|
||||||
const items = list.split(",").map((e) => e.trim()).filter((e) => e);
|
const items = list
|
||||||
|
.split(",")
|
||||||
|
.map((e) => e.trim())
|
||||||
|
.filter((e) => e);
|
||||||
if (!items.includes(item)) items.push(item);
|
if (!items.includes(item)) items.push(item);
|
||||||
return items.join(",");
|
return items.join(",");
|
||||||
}
|
}
|
||||||
function removeFromList(item: string, list: string): string {
|
function removeFromList(item: string, list: string): string {
|
||||||
return list.split(",").map((e) => e.trim()).filter((e) => e && e !== item).join(",");
|
return list
|
||||||
|
.split(",")
|
||||||
|
.map((e) => e.trim())
|
||||||
|
.filter((e) => e && e !== item)
|
||||||
|
.join(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
function markCommunicating(peerId: string) {
|
function markCommunicating(peerId: string) {
|
||||||
@@ -409,7 +411,12 @@
|
|||||||
</option>
|
</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
<button class="icon-button" onclick={() => createAndSelectP2PRemote()} title="Create P2P remote" aria-label="Create P2P remote">
|
<button
|
||||||
|
class="icon-button"
|
||||||
|
onclick={() => createAndSelectP2PRemote()}
|
||||||
|
title="Create P2P remote"
|
||||||
|
aria-label="Create P2P remote"
|
||||||
|
>
|
||||||
+
|
+
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -442,7 +449,8 @@
|
|||||||
<div class="peer-item">
|
<div class="peer-item">
|
||||||
<div class="peer-info">
|
<div class="peer-info">
|
||||||
<div class="peer-name">
|
<div class="peer-name">
|
||||||
{peer.name} : <span class="peer-id-mini" title={peer.peerId}>({peer.peerId.slice(0, 8)})</span>
|
{peer.name} :
|
||||||
|
<span class="peer-id-mini" title={peer.peerId}>({peer.peerId.slice(0, 8)})</span>
|
||||||
{#if isCommunicating(peer.peerId)}
|
{#if isCommunicating(peer.peerId)}
|
||||||
<span class="comm-icon" title="Communicating" aria-label="Communicating">📡</span>
|
<span class="comm-icon" title="Communicating" aria-label="Communicating">📡</span>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -460,11 +468,11 @@
|
|||||||
<button
|
<button
|
||||||
class="emoji-button"
|
class="emoji-button"
|
||||||
disabled={replicatingPeerId !== null}
|
disabled={replicatingPeerId !== null}
|
||||||
title={replicatingPeerId === peer.peerId ? 'Replicating...' : 'Replicate now'}
|
title={replicatingPeerId === peer.peerId ? "Replicating..." : "Replicate now"}
|
||||||
aria-label={replicatingPeerId === peer.peerId ? 'Replicating' : 'Replicate now'}
|
aria-label={replicatingPeerId === peer.peerId ? "Replicating" : "Replicate now"}
|
||||||
onclick={() => startReplication(peer)}
|
onclick={() => startReplication(peer)}
|
||||||
>
|
>
|
||||||
{replicatingPeerId === peer.peerId ? '⏳' : '🔄'}
|
{replicatingPeerId === peer.peerId ? "⏳" : "🔄"}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="action-button"
|
class="action-button"
|
||||||
@@ -478,25 +486,31 @@
|
|||||||
<span class="decision-label">WATCH</span>
|
<span class="decision-label">WATCH</span>
|
||||||
<button
|
<button
|
||||||
class="emoji-button {isWatching(peer.peerId) ? 'is-watching' : ''}"
|
class="emoji-button {isWatching(peer.peerId) ? 'is-watching' : ''}"
|
||||||
title={isWatching(peer.peerId) ? 'Watching this peer \u2014 click to stop' : 'Watch this peer\'s changes'}
|
title={isWatching(peer.peerId)
|
||||||
aria-label={isWatching(peer.peerId) ? 'Stop watching' : 'Watch peer'}
|
? "Watching this peer \u2014 click to stop"
|
||||||
|
: "Watch this peer's changes"}
|
||||||
|
aria-label={isWatching(peer.peerId) ? "Stop watching" : "Watch peer"}
|
||||||
disabled={!canEditP2PSettings()}
|
disabled={!canEditP2PSettings()}
|
||||||
onclick={() => toggleWatch(peer.peerId)}
|
onclick={() => toggleWatch(peer.peerId)}
|
||||||
>
|
>
|
||||||
{isWatching(peer.peerId) ? '🔔' : '🔕'}
|
{isWatching(peer.peerId) ? "🔔" : "🔕"}
|
||||||
</button>
|
</button>
|
||||||
</div> <div class="decision-row watch-row">
|
</div>
|
||||||
|
<div class="decision-row watch-row">
|
||||||
<span class="decision-label">SYNC</span>
|
<span class="decision-label">SYNC</span>
|
||||||
<button
|
<button
|
||||||
class="emoji-button {isSyncTarget(peer.name) ? 'is-watching' : ''}"
|
class="emoji-button {isSyncTarget(peer.name) ? 'is-watching' : ''}"
|
||||||
title={isSyncTarget(peer.name) ? 'Sync target \u2014 click to remove' : 'Set as sync target'}
|
title={isSyncTarget(peer.name)
|
||||||
aria-label={isSyncTarget(peer.name) ? 'Remove sync target' : 'Set sync target'}
|
? "Sync target \u2014 click to remove"
|
||||||
|
: "Set as sync target"}
|
||||||
|
aria-label={isSyncTarget(peer.name) ? "Remove sync target" : "Set sync target"}
|
||||||
disabled={!canEditP2PSettings()}
|
disabled={!canEditP2PSettings()}
|
||||||
onclick={() => toggleSyncTarget(peer)}
|
onclick={() => toggleSyncTarget(peer)}
|
||||||
>
|
>
|
||||||
{isSyncTarget(peer.name) ? '🔗' : '⛓️💥'}
|
{isSyncTarget(peer.name) ? "🔗" : "⛓️💥"}
|
||||||
</button>
|
</button>
|
||||||
</div> {:else}
|
</div>
|
||||||
|
{:else}
|
||||||
<div class="decision-status">
|
<div class="decision-status">
|
||||||
<span class="badge status-chip {getAcceptanceStatusClass(peer)}">
|
<span class="badge status-chip {getAcceptanceStatusClass(peer)}">
|
||||||
{getAcceptanceStatus(peer)}
|
{getAcceptanceStatus(peer)}
|
||||||
@@ -571,7 +585,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
padding: 0.75rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.peers-section {
|
.peers-section {
|
||||||
@@ -584,7 +597,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: wrap;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,8 +616,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.remote-picker {
|
.remote-picker {
|
||||||
max-width: 14rem;
|
max-width: 10rem;
|
||||||
min-width: 8rem;
|
min-width: 1em;
|
||||||
|
flex-shrink: 1;
|
||||||
height: 1.9rem;
|
height: 1.9rem;
|
||||||
border: 1px solid var(--divider-color);
|
border: 1px solid var(--divider-color);
|
||||||
border-radius: 0.4rem;
|
border-radius: 0.4rem;
|
||||||
@@ -648,6 +662,7 @@
|
|||||||
|
|
||||||
.peers-header {
|
.peers-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
@@ -873,5 +888,4 @@
|
|||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
Reference in new issue
Block a user