fix: fix some build errors

This commit is contained in:
2026-04-24 20:34:50 +02:00
parent 2984699033
commit e391e9ff6a
9 changed files with 43 additions and 25 deletions

View File

@ -546,7 +546,13 @@ pub async fn open_image_viewer(
builder = builder.position(x, y); builder = builder.position(x, y);
} }
builder.build().map_err(|e| e.to_string())?; let viewer = builder.build().map_err(|e| e.to_string())?;
viewer.eval(r#"(function(){
var s=document.createElement('style');
s.textContent='::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}*{scrollbar-width:none!important}';
var apply=function(){if(document.head)document.head.appendChild(s)};
if(document.head)apply();else document.addEventListener('DOMContentLoaded',apply);
})();"#).ok();
Ok(()) Ok(())
} }

View File

@ -21,6 +21,12 @@ pub fn run() {
use webkit2gtk::WebViewExt; use webkit2gtk::WebViewExt;
let window = app.get_webview_window("main").expect("no main window"); let window = app.get_webview_window("main").expect("no main window");
window.eval(r#"(function(){
var s=document.createElement('style');
s.textContent='*:not(.with-scrollbar)::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}*:not(.with-scrollbar){scrollbar-width:none!important}';
var apply=function(){if(document.head)document.head.appendChild(s)};
if(document.head)apply();else document.addEventListener('DOMContentLoaded',apply);
})();"#).ok();
window.with_webview(|wv| { window.with_webview(|wv| {
let webkit_view = wv.inner(); let webkit_view = wv.inner();
if let Some(parent) = webkit_view.parent() { if let Some(parent) = webkit_view.parent() {

View File

@ -1,5 +1,4 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { openUrl } from "@tauri-apps/plugin-opener";
import { useStore } from "../store"; import { useStore } from "../store";
import { SectionItem, QuestItem, CombatType } from "../types"; import { SectionItem, QuestItem, CombatType } from "../types";
import QuestDetailPanel from "./QuestDetailPanel"; import QuestDetailPanel from "./QuestDetailPanel";
@ -55,7 +54,7 @@ export default function GuideView() {
return ( return (
<div style={{ flex: 1, display: "flex", overflow: "hidden", minHeight: 0, position: "relative" }}> <div style={{ flex: 1, display: "flex", overflow: "hidden", minHeight: 0, position: "relative" }}>
<div style={{ flex: 1, overflowY: "auto", padding: "20px 24px" }}> <div className="with-scrollbar" style={{ flex: 1, overflowY: "auto", padding: "20px 24px" }}>
{/* Header */} {/* Header */}
<div style={{ marginBottom: "20px" }}> <div style={{ marginBottom: "20px" }}>
@ -181,7 +180,7 @@ export default function GuideView() {
{/* List */} {/* List */}
{!resourcesCollapsed && ( {!resourcesCollapsed && (
<div style={{ flex: 1, overflowY: "auto", padding: "10px 14px", scrollbarWidth: "none" }}> <div className="with-scrollbar" style={{ flex: 1, overflowY: "auto", padding: "10px 14px" }}>
{resources.map((r, i) => { {resources.map((r, i) => {
const owned = resourceInventory[r.name] ?? 0; const owned = resourceInventory[r.name] ?? 0;
const done = owned >= r.quantity; const done = owned >= r.quantity;

View File

@ -11,7 +11,7 @@ export default function HomeView() {
const inProgressGuides = guides.filter(g => g.completed_quests > 0 && g.completed_quests < g.total_quests); const inProgressGuides = guides.filter(g => g.completed_quests > 0 && g.completed_quests < g.total_quests);
return ( return (
<div style={{ flex: 1, overflowY: "auto", padding: "20px 24px", minHeight: 0 }}> <div className="with-scrollbar" style={{ flex: 1, overflowY: "auto", padding: "20px 24px", minHeight: 0 }}>
{/* Header */} {/* Header */}
<div style={{ marginBottom: "20px" }}> <div style={{ marginBottom: "20px" }}>
<h1 style={{ fontSize: "20px", fontWeight: 700, color: "#f0c040", marginBottom: "2px" }}> <h1 style={{ fontSize: "20px", fontWeight: 700, color: "#f0c040", marginBottom: "2px" }}>

View File

@ -120,7 +120,7 @@ export default function QuestDetailPanel({ questName, questUrl, profileId, onClo
</div> </div>
{/* Content */} {/* Content */}
<div style={{ flex: 1, overflowY: "auto", padding: "12px 16px", scrollbarWidth: "none" }}> <div className="with-scrollbar" style={{ flex: 1, overflowY: "auto", padding: "12px 16px" }}>
{loading && ( {loading && (
<div style={{ display: "flex", alignItems: "center", justifyContent: "center", height: "120px", color: "#4a5568", fontSize: "13px" }}> <div style={{ display: "flex", alignItems: "center", justifyContent: "center", height: "120px", color: "#4a5568", fontSize: "13px" }}>
<span style={{ animation: "spin 1s linear infinite", display: "inline-block", marginRight: "8px" }}></span> <span style={{ animation: "spin 1s linear infinite", display: "inline-block", marginRight: "8px" }}></span>

View File

@ -1,9 +1,9 @@
import { getCurrentWindow } from "@tauri-apps/api/window"; import { getCurrentWindow } from "@tauri-apps/api/window";
import type { ResizeEdge } from "@tauri-apps/api/window"; import type { ResizeDirection } from "@tauri-apps/api/window";
const S = 8; // grab zone size in px const S = 8; // grab zone size in px
const handles: { edge: ResizeEdge; style: React.CSSProperties }[] = [ const handles: { edge: ResizeDirection; style: React.CSSProperties }[] = [
{ edge: "North", style: { top: 0, left: S, right: S, height: S, cursor: "n-resize" } }, { edge: "North", style: { top: 0, left: S, right: S, height: S, cursor: "n-resize" } },
{ edge: "South", style: { bottom: 0, left: S, right: S, height: S, cursor: "s-resize" } }, { edge: "South", style: { bottom: 0, left: S, right: S, height: S, cursor: "s-resize" } },
{ edge: "West", style: { top: S, left: 0, bottom: S, width: S, cursor: "w-resize" } }, { edge: "West", style: { top: S, left: 0, bottom: S, width: S, cursor: "w-resize" } },

View File

@ -15,7 +15,6 @@ export default function Sidebar() {
const { guides, openGuide, activeGuideGid, view, sidebarCollapsed, setSidebarCollapsed } = useStore(); const { guides, openGuide, activeGuideGid, view, sidebarCollapsed, setSidebarCollapsed } = useStore();
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
const collapsed = sidebarCollapsed; const collapsed = sidebarCollapsed;
const setCollapsed = setSidebarCollapsed;
const windowWidth = useWindowWidth(); const windowWidth = useWindowWidth();
const isOverlay = collapsed || windowWidth < 500; const isOverlay = collapsed || windowWidth < 500;
@ -41,8 +40,7 @@ export default function Sidebar() {
}}> }}>
{/* Toggle button */} {/* Toggle button */}
<button <button
onClick={() => setCollapsed(c => !c)} onClick={() => setSidebarCollapsed(!sidebarCollapsed)} title={collapsed ? "Ouvrir le menu" : "Réduire le menu"}
title={collapsed ? "Ouvrir le menu" : "Réduire le menu"}
style={{ style={{
width: "100%", width: "100%",
height: "36px", height: "36px",

View File

@ -40,14 +40,13 @@ html, body {
padding: 0; padding: 0;
} }
html::-webkit-scrollbar, ::-webkit-scrollbar {
body::-webkit-scrollbar {
display: none; display: none;
width: 0; width: 0;
height: 0; height: 0;
} }
html, body { * {
scrollbar-width: none; scrollbar-width: none;
} }
@ -65,20 +64,25 @@ body {
user-select: none; user-select: none;
} }
/* Custom scrollbar */ /* Scrollbar explicite sur les zones qui en ont besoin */
::-webkit-scrollbar { .with-scrollbar {
width: 6px; scrollbar-width: thin !important;
height: 6px; scrollbar-color: var(--color-border-bright) var(--color-bg-deep) !important;
} }
::-webkit-scrollbar-track { .with-scrollbar::-webkit-scrollbar {
background: var(--color-bg-deep); display: block !important;
width: 4px !important;
height: 4px !important;
} }
::-webkit-scrollbar-thumb { .with-scrollbar::-webkit-scrollbar-track {
background: var(--color-border-bright); background: var(--color-bg-deep) !important;
border-radius: 3px;
} }
::-webkit-scrollbar-thumb:hover { .with-scrollbar::-webkit-scrollbar-thumb {
background: var(--color-gold-dim); background: var(--color-border-bright) !important;
border-radius: 2px !important;
}
.with-scrollbar::-webkit-scrollbar-thumb:hover {
background: var(--color-gold-dim) !important;
} }
/* Checkbox custom */ /* Checkbox custom */

View File

@ -12,6 +12,7 @@ interface AppState {
syncing: boolean; syncing: boolean;
syncProgress: { current: number; total: number; label: string } | null; syncProgress: { current: number; total: number; label: string } | null;
view: "home" | "guide"; view: "home" | "guide";
sidebarCollapsed: boolean;
resourcesPanelCollapsed: boolean; resourcesPanelCollapsed: boolean;
resourceInventory: Record<string, number>; resourceInventory: Record<string, number>;
@ -25,6 +26,7 @@ interface AppState {
loadGuides: () => Promise<void>; loadGuides: () => Promise<void>;
openGuide: (gid: string) => Promise<void>; openGuide: (gid: string) => Promise<void>;
setSidebarCollapsed: (collapsed: boolean) => void;
closeGuide: () => void; closeGuide: () => void;
toggleQuest: (questName: string) => Promise<void>; toggleQuest: (questName: string) => Promise<void>;
@ -43,6 +45,7 @@ export const useStore = create<AppState>((set, get) => ({
syncing: false, syncing: false,
syncProgress: null, syncProgress: null,
view: "home", view: "home",
sidebarCollapsed: false,
resourcesPanelCollapsed: false, resourcesPanelCollapsed: false,
resourceInventory: {}, resourceInventory: {},
@ -111,6 +114,8 @@ export const useStore = create<AppState>((set, get) => ({
set({ activeGuideGid: gid, activeGuideData: data, view: "guide" }); set({ activeGuideGid: gid, activeGuideData: data, view: "guide" });
}, },
setSidebarCollapsed: (collapsed) => set({ sidebarCollapsed: collapsed }),
closeGuide: () => { closeGuide: () => {
invoke("set_setting", { key: "active_guide", value: "" }); invoke("set_setting", { key: "active_guide", value: "" });
set({ activeGuideGid: null, activeGuideData: null, view: "home" }); set({ activeGuideGid: null, activeGuideData: null, view: "home" });