Merge branch 'v1.5.0' into feature/playlists/107

This commit is contained in:
MathieuG-P
2024-03-22 15:12:26 +01:00
59 changed files with 695 additions and 1024 deletions
@@ -29,6 +29,10 @@ export const EditVersionModal: ModalComponent<{ name: string; color: string }, {
setColor(configService.get("second-color" as DefaultConfigKey));
};
const resetName = () => {
setName(version.BSVersion);
};
return (
<form
className="static"
@@ -44,7 +48,12 @@ export const EditVersionModal: ModalComponent<{ name: string; color: string }, {
<label className="block font-bold cursor-pointer tracking-wide text-gray-800 dark:text-gray-200" htmlFor="name">
{t("modals.clone-version.inputs.name.label")}
</label>
<input className="w-full bg-light-main-color-1 dark:bg-main-color-1 px-1 py-[2px] rounded-md outline-none" onChange={e => setName(e.target.value)} value={name} type="text" name="name" id="name" minLength={2} maxLength={15} placeholder={t("modals.clone-version.inputs.name.placeholder")} />
<div className="relative">
<input className="w-full bg-light-main-color-1 dark:bg-main-color-1 px-1 py-[2px] rounded-md outline-none" onChange={e => setName(e.target.value)} value={name} type="text" name="name" id="name" minLength={2} maxLength={15} placeholder={t("modals.clone-version.inputs.name.placeholder")} />
<div className="absolute right-2 top-0 h-full flex items-center">
<BsmButton onClick={resetName} className="px-2 font-bold italic text-sm rounded-md" text="pages.settings.appearance.reset" withBar={false} />
</div>
</div>
</div>
<div>
<span className="block font-bold tracking-wide text-gray-800 dark:text-gray-200">{t("modals.clone-version.inputs.color.label")}</span>
@@ -12,6 +12,7 @@ import { ConfigurationService } from "renderer/services/configuration.service";
import { IpcService } from "renderer/services/ipc.service";
import { ModalComponent } from "renderer/services/modale.service";
import { FolderLinkState, VersionFolderLinkerService, VersionLinkerActionType } from "renderer/services/version-folder-linker.service";
import { lastValueFrom } from "rxjs";
import { BSVersion } from "shared/bs-version.interface";
export const ShareFoldersModal: ModalComponent<void, BSVersion> = ({ options: {data} }) => {
@@ -45,14 +46,14 @@ export const ShareFoldersModal: ModalComponent<void, BSVersion> = ({ options: {d
}, [folders]);
const addFolder = async () => {
const versionPath = await versionManager.getVersionPath(data).toPromise();
const folder = await ipc.sendV2<{ canceled: boolean; filePaths: string[] }, string>("choose-folder", { args: versionPath }).toPromise();
const versionPath = await lastValueFrom(versionManager.getVersionPath(data));
const folder = await lastValueFrom(ipc.sendV2("choose-folder", versionPath));
if (!folder || folder.canceled || !folder.filePaths?.length) {
return;
}
const relativeFolder = await ipc.sendV2<string>("full-version-path-to-relative", { args: { version: data, fullPath: folder.filePaths[0] } }).toPromise();
const relativeFolder = await lastValueFrom(ipc.sendV2("full-version-path-to-relative", { version: data, fullPath: folder.filePaths[0] }));
if (folders.includes(relativeFolder)) {
return;
@@ -10,11 +10,13 @@ import { BsmIconType } from "../svgs/bsm-icon.component";
import "./title-bar.component.css";
import { useService } from "renderer/hooks/use-service.hook";
import { lastValueFrom } from "rxjs";
import { useWindowControls } from "renderer/hooks/use-window-controls.hook";
export default function TitleBar({ template = "index.html" }: { template: AppWindow }) {
const ipcService = useService(IpcService);
const audio = useService(AudioPlayerService);
const windowControls = useWindowControls();
const volume = useObservable(() => audio.volume$, audio.volume);
const color = useThemeColor("first-color");
@@ -22,7 +24,7 @@ export default function TitleBar({ template = "index.html" }: { template: AppWin
const [previewVersion, setPreviewVersion] = useState(null);
useEffect(() => {
lastValueFrom(ipcService.sendV2<string>("current-version")).then(version => {
lastValueFrom(ipcService.sendV2("current-version")).then(version => {
if (version.toLocaleLowerCase().includes("alpha")) {
return setPreviewVersion("ALPHA");
}
@@ -35,19 +37,19 @@ export default function TitleBar({ template = "index.html" }: { template: AppWin
const [maximized, setMaximized] = useState(false);
const closeWindow = () => {
return window.electron.window.close();
return windowControls.close();
};
const maximizeWindow = () => {
window.electron.window.maximise();
windowControls.maximise();
};
const minimizeWindow = () => {
window.electron.window.minimise();
windowControls.minimise();
};
const resetWindow = () => {
window.electron.window.unmaximise();
windowControls.unmaximise();
};
const toogleMaximize = () => {
@@ -117,7 +119,7 @@ export default function TitleBar({ template = "index.html" }: { template: AppWin
</header>
);
}
return (
<header id="titlebar" className="min-h-[22px] bg-transparent w-screen h-[22px] flex content-center items-center justify-start z-10">
<div id="drag-region" className="grow h-full">