Skip to content

Commit

Permalink
change wording to say osu! folder instead of songs folder
Browse files Browse the repository at this point in the history
  • Loading branch information
hrfarmer committed Oct 4, 2024
1 parent 6f9535d commit 6567bfe
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 59 deletions.
104 changes: 55 additions & 49 deletions src/RequestAPI.d.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,65 @@
import type { SearchQuery } from './main/lib/search-parser/@search-types';
import type { ConfigError, ConfigSuccess } from './main/lib/template-parser/parser/TemplateParser';
import type {
InfiniteScrollerInitResponse,
InfiniteScrollerRequest,
InfiniteScrollerResponse
} from './renderer/src/components/InfiniteScroller';
import type {
AudioSource,
ImageSource,
Optional,
QueueCreatePayload,
ResourceID,
ResourceTables,
Result, Settings,
Song, SongsQueryPayload
} from './@types';
Result,
Settings,
Song,
SongsQueryPayload
} from "./@types";
import type { SearchQuery } from "./main/lib/search-parser/@search-types";
import type { ConfigError, ConfigSuccess } from "./main/lib/template-parser/parser/TemplateParser";
import type {
InfiniteScrollerInitResponse,
InfiniteScrollerRequest,
InfiniteScrollerResponse
} from "./renderer/src/components/InfiniteScroller";

export type RequestAPI = {
"resource::get": (
id: ResourceID,
table: ResourceTables
) => Optional<Song | AudioSource | ImageSource>;
"resource::getPath": (id: any) => Result<string, string>;
"resource::getMediaSessionImage": (bgPath: string) => Optional<string>;

"queue::exists": () => boolean;
"queue::current": () => Optional<Song>;
"queue::duration": () => Optional<number>;
"queue::remainingDuration": () => Optional<number>;
"queue::next": () => void;
"queue::previous": () => void;
"queue::play": (song: ResourceID) => void;
"queue::playNext": (song: ResourceID) => void;
"queue::place": (what: ResourceID, after: ResourceID | undefined) => void;
"queue::removeSong": (song: ResourceID | undefined) => void;
"queue::create": (payload: QueueCreatePayload) => void;
"queue::shuffle": () => void;

export type RequestAPI = {
"resource::get": (id: ResourceID, table: ResourceTables) => Optional<Song | AudioSource | ImageSource>,
"resource::getPath": (id: any) => Result<string, string>,
"resource::getMediaSessionImage": (bgPath: string) => Optional<string>,

"queue::exists": () => boolean,
"queue::current": () => Optional<Song>,
"queue::duration": () => Optional<number>,
"queue::remainingDuration": () => Optional<number>,
"queue::next": () => void,
"queue::previous": () => void,
"queue::play": (song: ResourceID) => void,
"queue::playNext": (song: ResourceID) => void,
"queue::place": (what: ResourceID, after: ResourceID | undefined) => void,
"queue::removeSong": (song: ResourceID | undefined) => void,
"queue::create": (payload: QueueCreatePayload) => void,
"queue::shuffle": () => void,

"dir::select": () => Optional<string>,
"dir::autoGetOsuSongsDir": () => Optional<string>,
"dir::submit": (dir: string) => void,

"error::dismissed": () => void,

"parse::search": (query: string) => SearchQuery,
"parse::template": (template: string) => ConfigSuccess | ConfigError,

"settings::write": <K extends keyof Settings>(key: K, value: any) => void,
"settings::get": <K extends keyof Settings>(key: K) => Optional<any>,

"query::songsPool::init": (payload: SongsQueryPayload) => InfiniteScrollerInitResponse,
"query::songsPool": (request: InfiniteScrollerRequest, payload: SongsQueryPayload) => InfiniteScrollerResponse<Song>,
"query::queue::init": () => InfiniteScrollerInitResponse,
"query::queue": (request: InfiniteScrollerRequest) => InfiniteScrollerResponse<Song>,

"save::localVolume": (volume: number, song: ResourceID) => void,

"dev::storeLocation": () => string,
}
"dir::select": () => Optional<string>;
"dir::autoGetOsuDir": () => Optional<string>;
"dir::submit": (dir: string) => void;

"error::dismissed": () => void;

"parse::search": (query: string) => SearchQuery;
"parse::template": (template: string) => ConfigSuccess | ConfigError;

"settings::write": <K extends keyof Settings>(key: K, value: any) => void;
"settings::get": <K extends keyof Settings>(key: K) => Optional<any>;

"query::songsPool::init": (payload: SongsQueryPayload) => InfiniteScrollerInitResponse;
"query::songsPool": (
request: InfiniteScrollerRequest,
payload: SongsQueryPayload
) => InfiniteScrollerResponse<Song>;
"query::queue::init": () => InfiniteScrollerInitResponse;
"query::queue": (request: InfiniteScrollerRequest) => InfiniteScrollerResponse<Song>;

"save::localVolume": (volume: number, song: ResourceID) => void;

"dev::storeLocation": () => string;
};
4 changes: 2 additions & 2 deletions src/main/router/dir-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { none, some } from "../lib/rust-like-utils-backend/Optional";

Router.respond("dir::select", () => {
const path = dialog.showOpenDialogSync({
title: "Select your osu! Songs folder",
title: "Select your osu! folder",
properties: ["openDirectory"]
});

Expand All @@ -16,7 +16,7 @@ Router.respond("dir::select", () => {
return some(path[0]);
});

Router.respond("dir::autoGetOsuSongsDir", () => {
Router.respond("dir::autoGetOsuDir", () => {
if (process.platform === "win32") {
if (process.env.LOCALAPPDATA === undefined) {
return none();
Expand Down
16 changes: 8 additions & 8 deletions src/renderer/src/components/scenes/DirSelectScene.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createSignal } from 'solid-js';
import '../../assets/css/scenes/dir-select.css';
import { createSignal } from "solid-js";
import "../../assets/css/scenes/dir-select.css";

export default function DirSelectScene() {
const [dir, setDir] = createSignal("")
const [dir, setDir] = createSignal("");

const selectDir = async () => {
const opt = await window.api.request("dir::select");
Expand All @@ -11,25 +11,25 @@ export default function DirSelectScene() {
}

setDir(opt.value);
}
};

const autodetectDir = async () => {
const autoGetDir = await window.api.request("dir::autoGetOsuSongsDir");
const autoGetDir = await window.api.request("dir::autoGetOsuDir");
if (autoGetDir.isNone) {
return;
}

setDir(autoGetDir.value);
}
};

const submitDir = async () => {
await window.api.request("dir::submit", dir());
}
};

return (
<div id="dir-select" class="scene">
<div class="column">
<h2>Your osu! Songs folder:</h2>
<h2>Your osu! folder:</h2>
<code classList={{ empty: dir() === "" }}>
{dir() === "" ? "[No folder selected]" : dir()}
</code>
Expand Down

0 comments on commit 6567bfe

Please sign in to comment.