refactor(components): code formatting and cleanup

This commit is contained in:
Ivan
2026-04-13 18:32:41 -05:00
parent ca4aadf2f9
commit 059d2cbdc1
10 changed files with 982 additions and 987 deletions
+10 -8
View File
@@ -24,19 +24,19 @@
}
</style>
</head>
<body class="min-h-screen antialiased bg-gradient-to-b from-slate-100 to-slate-200 text-slate-800 dark:from-zinc-950 dark:to-zinc-900 dark:text-zinc-100">
<body
class="min-h-screen antialiased bg-gradient-to-b from-slate-100 to-slate-200 text-slate-800 dark:from-zinc-950 dark:to-zinc-900 dark:text-zinc-100"
>
<main class="flex min-h-screen items-center justify-center px-4 py-10 sm:px-6">
<div class="w-full max-w-sm">
<div
class="overflow-hidden rounded-2xl border border-slate-200/80 bg-white/90 shadow-lg shadow-slate-200/50 backdrop-blur-sm dark:border-zinc-700/80 dark:bg-zinc-900/90 dark:shadow-black/40"
>
<div class="px-6 pt-8 pb-2 text-center">
<div class="mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-2xl bg-white shadow-inner ring-1 ring-slate-200/80 dark:bg-zinc-950 dark:ring-zinc-700">
<img
class="h-10 w-10 object-contain"
src="./assets/images/logo.png"
alt=""
/>
<div
class="mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-2xl bg-white shadow-inner ring-1 ring-slate-200/80 dark:bg-zinc-950 dark:ring-zinc-700"
>
<img class="h-10 w-10 object-contain" src="./assets/images/logo.png" alt="" />
</div>
<h1 class="text-xl font-semibold tracking-tight text-slate-900 dark:text-white">MeshChatX</h1>
<p id="status-line" class="mt-2 text-sm leading-relaxed text-slate-600 dark:text-zinc-400">
@@ -55,7 +55,9 @@
id="attempt-hint"
class="mt-3 min-h-[1.25rem] text-center text-xs text-slate-500 dark:text-zinc-500"
></p>
<p class="mt-4 text-center text-[11px] text-slate-400 dark:text-zinc-600" id="app-version">v0.0.0</p>
<p class="mt-4 text-center text-[11px] text-slate-400 dark:text-zinc-600" id="app-version">
v0.0.0
</p>
</div>
</div>
</div>
+2 -6
View File
@@ -997,16 +997,12 @@ export default {
? json.saved_path
: json.error || json.status || "";
if (json.status === "completed") {
ToastUtils.success(
`${this.$t("rncp.received_file")}${detail ? ": " + detail : ""}`,
);
ToastUtils.success(`${this.$t("rncp.received_file")}${detail ? ": " + detail : ""}`);
if (ElectronUtils.isElectron()) {
ElectronUtils.showNotification(this.$t("rncp.received_file"), detail || "");
}
} else {
ToastUtils.error(
`${this.$t("rncp.receive_failed")}${detail ? ": " + detail : ""}`,
);
ToastUtils.error(`${this.$t("rncp.receive_failed")}${detail ? ": " + detail : ""}`);
}
}
break;
@@ -1263,7 +1263,7 @@ export default {
return;
}
const ok = await ElectronUtils.revealPathInFolderOrCopy(reticulumConfigPath, () =>
ToastUtils.success(this.$t("common.copied")),
ToastUtils.success(this.$t("common.copied"))
);
if (!ok) {
DialogUtils.alert(reticulumConfigPath);
@@ -1275,7 +1275,7 @@ export default {
return;
}
const ok = await ElectronUtils.revealPathInFolderOrCopy(databasePath, () =>
ToastUtils.success(this.$t("common.copied")),
ToastUtils.success(this.$t("common.copied"))
);
if (!ok) {
DialogUtils.alert(databasePath);
@@ -548,17 +548,17 @@
{{ formatTimeAgo(entry.items[0].lxmf_message.created_at) }}
</span>
<div v-if="entry.items[0].is_outbound" class="flex items-center gap-1">
<span
v-if="isOpportunisticDeferredDelivery(entry.items[0].lxmf_message)"
class="text-[9px] font-bold uppercase tracking-wider"
:class="
isThemeOutboundBubble(entry.items[0])
? 'text-amber-800 dark:text-amber-300'
: 'text-amber-200'
"
>
{{ $t("messages.opportunistic_deferred_label") }}
</span>
<span
v-if="isOpportunisticDeferredDelivery(entry.items[0].lxmf_message)"
class="text-[9px] font-bold uppercase tracking-wider"
:class="
isThemeOutboundBubble(entry.items[0])
? 'text-amber-800 dark:text-amber-300'
: 'text-amber-200'
"
>
{{ $t("messages.opportunistic_deferred_label") }}
</span>
<span
v-else-if="
['failed', 'cancelled', 'rejected'].includes(
@@ -336,7 +336,7 @@ export default {
pageSize: 1000,
searchQuery: "",
hopFilterSlider: 0,
_hopFilterDebounce: null,
hopFilterDebounceTimer: null,
abortController: new AbortController(),
currentLOD: "high",
};
@@ -397,9 +397,9 @@ export default {
}
},
hopFilterSlider() {
if (this._hopFilterDebounce) clearTimeout(this._hopFilterDebounce);
this._hopFilterDebounce = setTimeout(() => {
this._hopFilterDebounce = null;
if (this.hopFilterDebounceTimer) clearTimeout(this.hopFilterDebounceTimer);
this.hopFilterDebounceTimer = setTimeout(() => {
this.hopFilterDebounceTimer = null;
this.processVisualization();
}, 80);
},
@@ -417,9 +417,9 @@ export default {
this.stopOrbit();
this.stopBouncingBalls();
clearInterval(this.reloadInterval);
if (this._hopFilterDebounce) {
clearTimeout(this._hopFilterDebounce);
this._hopFilterDebounce = null;
if (this.hopFilterDebounceTimer) {
clearTimeout(this.hopFilterDebounceTimer);
this.hopFilterDebounceTimer = null;
}
if (this.network) {
this.network.destroy();
@@ -1263,11 +1263,7 @@ export default {
continue;
}
if (
this.hopFilterMax != null &&
disc.hops != null &&
disc.hops > this.hopFilterMax
) {
if (this.hopFilterMax != null && disc.hops != null && disc.hops > this.hopFilterMax) {
continue;
}
@@ -182,7 +182,11 @@
{{ sendResult.filePath }}
</div>
<div v-if="sendResult.success && sendResult.filePath" class="flex gap-2">
<button type="button" class="secondary-chip text-xs py-1 px-2" @click="openPathInOs(sendResult.filePath)">
<button
type="button"
class="secondary-chip text-xs py-1 px-2"
@click="openPathInOs(sendResult.filePath)"
>
{{ $t("rncp.show_in_folder") }}
</button>
</div>
@@ -288,11 +292,18 @@
"
>
<div>{{ fetchResult.message }}</div>
<div v-if="fetchResult.success && fetchResult.savedPath" class="font-mono text-xs break-all">
<div
v-if="fetchResult.success && fetchResult.savedPath"
class="font-mono text-xs break-all"
>
{{ fetchResult.savedPath }}
</div>
<div v-if="fetchResult.success && fetchResult.savedPath" class="flex gap-2">
<button type="button" class="secondary-chip text-xs py-1 px-2" @click="openPathInOs(fetchResult.savedPath)">
<button
type="button"
class="secondary-chip text-xs py-1 px-2"
@click="openPathInOs(fetchResult.savedPath)"
>
{{ $t("rncp.show_in_folder") }}
</button>
</div>
@@ -535,7 +546,7 @@ export default {
listenFetchJail: this.listenFetchJail,
listenFetchAllowed: this.listenFetchAllowed,
listenAllowOverwrite: this.listenAllowOverwrite,
}),
})
);
} catch {
// ignore quota / private mode
@@ -579,7 +590,7 @@ export default {
return;
}
const ok = await ElectronUtils.revealPathInFolderOrCopy(filePath, () =>
ToastUtils.success(this.$t("common.copied")),
ToastUtils.success(this.$t("common.copied"))
);
if (!ok) {
DialogUtils.alert(filePath);
@@ -593,7 +604,7 @@ export default {
return;
}
const ok = await ElectronUtils.openDirectoryOrCopy(this.receiveDirectory, () =>
ToastUtils.success(this.$t("common.copied")),
ToastUtils.success(this.$t("common.copied"))
);
if (!ok) {
DialogUtils.alert(this.receiveDirectory);
@@ -658,15 +669,9 @@ export default {
error: data.error,
};
if (data.status === "completed" && data.saved_path) {
this.notifyRncp(
this.$t("rncp.received_file"),
data.saved_path,
);
this.notifyRncp(this.$t("rncp.received_file"), data.saved_path);
} else if (data.status !== "completed") {
this.notifyRncpError(
this.$t("rncp.receive_failed"),
data.error || data.status,
);
this.notifyRncpError(this.$t("rncp.receive_failed"), data.error || data.status);
}
}
} catch {
+2 -2
View File
@@ -28,8 +28,8 @@
"
>
<strong style="display: block; margin-bottom: 0.35rem">JavaScript is required</strong>
MeshChatX needs JavaScript enabled for the user interface. Enable JavaScript in your browser
settings and reload this page.
MeshChatX needs JavaScript enabled for the user interface. Enable JavaScript in your browser settings
and reload this page.
</div>
</noscript>
<div id="app"></div>
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -62,9 +62,7 @@ describe("BotsPage.vue", () => {
const wrapper = mountBotsPage();
await vi.waitFor(() => expect(wrapper.vm.loading).toBe(false));
const selectBtn = wrapper
.findAll("button")
.find((b) => b.text().includes("bots.select"));
const selectBtn = wrapper.findAll("button").find((b) => b.text().includes("bots.select"));
await selectBtn.trigger("click");
expect(wrapper.vm.selectedTemplate).not.toBeNull();
+1 -3
View File
@@ -93,9 +93,7 @@ describe("Interface.vue", () => {
it("action buttons and dropdown have shrink-0 to prevent squashing", () => {
const wrapper = mountInterface();
const actionsCol = wrapper.find(
".absolute.top-2.right-2.z-20.flex.flex-row.items-center.gap-1.sm\\:static",
);
const actionsCol = wrapper.find(".absolute.top-2.right-2.z-20.flex.flex-row.items-center.gap-1.sm\\:static");
expect(actionsCol.classes()).toContain("sm:shrink-0");
const btn = wrapper.find('button[title="interface.disable"]');
expect(btn.classes()).toContain("shrink-0");