Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from maotovisk/dev
Browse files Browse the repository at this point in the history
feat: new ui usage and version bump
  • Loading branch information
maotovisk authored Jun 30, 2023
2 parents 76815b3 + 79fea04 commit 9250653
Show file tree
Hide file tree
Showing 12 changed files with 178 additions and 81 deletions.
80 changes: 60 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,85 @@
name: 'publish'
name: "publish"
on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
publish-tauri:
permissions:
contents: write
build-binaries:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-20.04, windows-latest]
platform:
- os: ubuntu-latest
rust_target: x86_64-unknown-linux-gnu
- os: macos-latest
rust_target: x86_64-apple-darwin
- os: macos-latest
rust_target: aarch64-apple-darwin
- os: windows-latest
rust_target: x86_64-pc-windows-msvc

runs-on: ${{ matrix.platform }}
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v3
- name: setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: "Setup Rust"
uses: actions-rs/toolchain@v1
with:
default: true
override: true
profile: minimal
toolchain: stable
target: ${{ matrix.platform.rust_target }}

- uses: Swatinem/rust-cache@v2

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
if: matrix.platform.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: install frontend dependencies
run: pnpm install # change this to npm or pnpm depending on which one you use
- uses: tauri-apps/tauri-action@v0
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- uses: JonasKruckenberg/[email protected]
id: tauri_build
with:
target: ${{ matrix.platform.rust_target }}

# The artifacts output can now be used to upload the artifacts
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: "${{ join(fromJSON(steps.tauri_build.outputs.artifacts), '\n') }}"

publish:
needs: build-binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Download the previously uploaded artifacts
- uses: actions/download-artifact@v3
id: download
with:
name: artifacts
path: artifacts
# And create a release with the artifacts attached
- name: "create release"
uses: softprops/action-gh-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
tagName: hitsound-copier-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: 'Hitsound Copier v__VERSION__'
releaseBody: 'This is a automated release.'
releaseDraft: true
prerelease: false
draft: false
files: ./artifacts/**/*
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hitsound-copier",
"private": true,
"version": "0.0.6",
"version": "0.0.7",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hitsound-copier"
version = "0.0.6"
version = "0.0.7"
description = "A osu! mapping toolbox made in TS with tauri"
authors = ["maotovisk"]
license = ""
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "hitsound-copier",
"version": "0.0.6"
"version": "0.0.7"
},
"tauri": {
"allowlist": {
Expand Down
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import "material-dynamic-colors";
import "material-icons/iconfont/material-icons.css";
import "./view/style/main.scss";

declare global {
interface Window {
sendNotification: any;
}
}

const app = new App({
target: document.getElementById("app"),
});
Expand Down
17 changes: 8 additions & 9 deletions src/view/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@
import SideBar from "./lib/SideBar.svelte";
import HitsoundCopier from "./tabs/HitsoundCopier.svelte";
import Changelog from "./tabs/Changelog.svelte";
import { onMount, setContext, tick } from "svelte";
import { onMount } from "svelte";
import Toast from "./lib/Toast.svelte";
import Settings from "./tabs/Settings.svelte";
onMount(async () => {
await ui("theme", "#c43b80");
});
</script>

<Router>
<Router url={"/home"}>
<SideBar />
<main class="surface responsive max">
<Route path="/home">
<Changelog />
</Route>
<Route path="/hs-copier">
<HitsoundCopier />
</Route>
<Route path="/settings" />
<Route path="/home" component={Changelog} />
<Route path="/hs-copier" component={HitsoundCopier} />
<Route path="/settings" component={Settings} />
</main>
</Router>
<Toast />
56 changes: 29 additions & 27 deletions src/view/lib/FileInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,32 +71,34 @@
export { isUnique, selected, defaultFilePath, textLabel };
</script>

<div class="row middle-align">
<div class="field label max">
<input type="text" bind:value={selected[0]} />
<label>{textLabel}</label>
<article class="surface-variant">
<div class="row middle-align">
<div class="field label max">
<input type="text" bind:value={selected[0]} />
<label>{textLabel}</label>
</div>
{#if !isUnique}
<strong>Selected {selected.length} file(s)</strong>
{/if}
<button class="transparent circle" on:click={selectFrom}>
<i>file_open</i>
</button>
</div>
{#if !isUnique}
<strong>Selected {selected.length} file(s)</strong>
{/if}
<button class="transparent circle" on:click={selectFrom}>
<i>file_open</i>
</button>
</div>
{#if selected.length > 1}
{#each selected as selected_file, i}
{#if i > 0}
<div class="row">
<div class="field max">
<input type="text" bind:value={selected[i]} />
{#if selected.length > 1}
{#each selected as selected_file, i}
{#if i > 0}
<div class="row">
<div class="field max">
<input type="text" bind:value={selected[i]} />
</div>
<button
class="transparent circle"
on:click={() => removeFromList(selected_file)}
>
<i>close</i>
</button>
</div>
<button
class="transparent circle"
on:click={() => removeFromList(selected_file)}
>
<i>close</i>
</button>
</div>
{/if}
{/each}
{/if}
{/if}
{/each}
{/if}
</article>
6 changes: 4 additions & 2 deletions src/view/lib/SideBar.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts">
import { Link } from "svelte-routing";
let currentUrl = "";
let currentUrl = "/home";
const updateUrl = (toRoute: string) => {
currentUrl = toRoute;
};
</script>

<nav class="m l left secondary">
<nav class="left secondary">
<header class="fixed" />
<Link
class="row round {currentUrl.includes('/home') ? 'active' : ''}"
Expand All @@ -26,6 +26,8 @@
<i>file_copy</i>
<span>Hitsound Copier</span>
</Link>
<div class="max" />
<div class="medium-divisor" />
<Link
class="row round {currentUrl.includes('/settings') ? 'active' : ''}"
to="/settings"
Expand Down
25 changes: 25 additions & 0 deletions src/view/lib/Toast.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script lang="ts">
let icon: string = "info";
let message: string = "";
let color: string = "green";
window.sendNotification = ({
icon: notificationIcon,
color: notificationColor,
message: notificationMessage,
}: {
icon: string;
message: string;
color: string;
}) => {
icon = notificationIcon;
message = notificationMessage;
color = notificationColor;
ui("#toast");
};
</script>

<div class="toast {color}" id="toast">
<i>{icon}</i>
<span>{message}</span>
</div>
49 changes: 30 additions & 19 deletions src/view/tabs/HitsoundCopier.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
const copyHitsoundsAction = async () => {
try {
if (selectedFrom.length == 0 || !(await exists(selectedFrom[0])))
return message("Origin beatmap file not found", {
title: "Hitsound Copier",
type: "error",
return window.sendNotification({
color: "error",
message: "Selected origin beatmap file not found",
icon: "error",
});
const fromContent: string = await readTextFile(selectedFrom[0]);
Expand All @@ -29,9 +30,10 @@
);
if (arrayToPathExists.includes(false)) {
return message("Selected destination beatmap not found", {
title: "Hitsound Copier",
type: "error",
return window.sendNotification({
color: "error",
message: "Selected destination beatmap(s) file(s) not found",
icon: "error",
});
}
Expand All @@ -47,16 +49,15 @@
overwriteNotDefined: overwriteNotDefinedOption,
});
await message(
`Hitsounds copied successfully to ${copiedHitsound.length} beatmaps!`,
{
title: "Done!",
}
);
copiedHitsound.forEach(async (hitsoundedBeatmap, key) => {
await writeFile(selectedTo[key], hitsoundedBeatmap);
});
window.sendNotification({
color: "primary",
message: `Hitsounds copied successfully to ${copiedHitsound.length} beatmaps!`,
icon: "check",
});
} catch (e) {
console.log(e);
return message(e, { title: "Hitsound Copier", type: "error" });
Expand All @@ -78,11 +79,11 @@
isUnique={false}
bind:defaultFilePath={selectedFrom}
/>
<div class="row">
<span>Options</span>
</div>
<div class="small-divider" />
<article class="surface-variant">
<div class="row">
<span>Options</span>
</div>
<div class="small-divider" />
<div class="row">
<div class="field middle-align max">
<nav>
Expand Down Expand Up @@ -159,14 +160,24 @@
</div>
</div>
</article>
<div class="row">
<div class="row btn-row">
<div class="max" />
<button class="extend square round" on:click={copyHitsoundsAction}>
<button
class="extend square round small-elevate"
on:click={copyHitsoundsAction}
>
<i>check</i>
<span>Copy Hitsound</span>
</button>
</div>
</div>

<style>
.btn-row {
padding: 2rem;
position: fixed;
bottom: 0;
right: 0;
z-index: 1;
}
</style>
Loading

0 comments on commit 9250653

Please sign in to comment.