Skip to content

Commit

Permalink
feat: add dev build ci & new form help text in GUI (#8)
Browse files Browse the repository at this point in the history
* ci: add dev build ci

* ci: rename GUI ci name

* ci: add tag

* ci(dev): remove tag in changelog

* ci(dev): remove changelog action

* ci(dev): attempt new changelog

* ci(release): add if condition

* ci(dev): add recreate tag action

* ci(dev): change recreate tag action

* ci(dev): add `force` in recreate tag action

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): attempt recreate tag ci

* ci(dev): revert changelog action

* fix(front): fix css preset design

* feat(front-form): change help texts

Implemented a suggestion for more clarity in posts

* ci(cli): change toolchain action

Node.js 12 is old

* fix(front): remove removed import
  • Loading branch information
SARDONYX-sard authored Oct 9, 2023
1 parent 680ef30 commit 20a64c4
Show file tree
Hide file tree
Showing 11 changed files with 318 additions and 121 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/dev-release-cli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Development Release CLI

on:
push:
branches: ["development"]

jobs:
build:
name: Release binary
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: dar2oar
asset_name: dar2oar-x86_64-unknown-linux-gnu.tar.gz
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: dar2oar
asset_name: dar2oar-x86_64-unknown-linux-musl.tar.gz
- os: ubuntu-latest
target: x86_64-pc-windows-gnu
artifact_name: dar2oar.exe
asset_name: dar2oar-x86_64-pc-windows-gnu.zip
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: dar2oar
asset_name: dar2oar-x86_64-apple-darwin.zip

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Without it, once created, the commit sha for the tag will not be updated.
- name: Recreate tag
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git tag "development" -m "Development version" --force
git push -f --tags
if: matrix.target == 'x86_64-pc-windows-gnu'

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Cross build with all features
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }} --all-features --verbose

- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
if: matrix.target == 'x86_64-pc-windows-gnu'

- name: Compress binary
run: |
if [[ "${{ matrix.target }}" == *"linux"* ]]; then
tar -czf ${{ matrix.asset_name }} target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
else
zip -r ${{ matrix.asset_name }} target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
fi
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
release_name: DAR to OAR Converter Development-${{ github.sha }}
body: ${{ steps.changelog.outputs.changes }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.asset_name }}
asset_name: ${{ matrix.asset_name }}
tag: "development"
prerelease: true
overwrite: true
65 changes: 65 additions & 0 deletions .github/workflows/dev-release-gui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Development Release GUI
on:
push:
branches:
- "development"
workflow_dispatch:

jobs:
release:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.platform }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
# You can remove libayatana-appindicator3-dev if you don't use the system tray feature.
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
- name: Rust setup
uses: dtolnay/rust-toolchain@stable

- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"

- name: Sync node version and setup cache
uses: actions/setup-node@v3
with:
node-version: "lts/*"

- name: Install frontend dependencies
run: npm install

- name: Sync node version and setup cache
uses: actions/cache@v3
with:
path: |
~/.npm
${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Build the app
uses: tauri-apps/tauri-action@v0

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseName: "DAR to OAR Converter Development-${{ github.sha }}" # tauri-action replaces \_\_VERSION\_\_ with the app version.
tagName: development
prerelease: true
4 changes: 2 additions & 2 deletions .github/workflows/release-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ jobs:
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true

- name: Cross build with all features
uses: actions-rs/cargo@v1
Expand All @@ -53,6 +52,7 @@ jobs:
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
if: matrix.target == 'x86_64-pc-windows-gnu'

- name: Compress binary
run: |
Expand Down
63 changes: 52 additions & 11 deletions frontend/src/components/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ export function ConvertForm() {
};

return (
<Grid container component="form" onSubmit={handleSubmit(onSubmit)}>
<Grid
sx={{ display: "block", width: "95vw" }}
container
component="form"
onSubmit={handleSubmit(onSubmit)}
>
<FormGroup onSubmit={handleSubmit(onSubmit)}>
<Button
sx={{ width: "100%", marginBottom: "50px" }}
sx={{ width: "100%", marginBottom: "35px" }}
variant="outlined"
onClick={handleAllClear}
>
Expand All @@ -116,7 +121,7 @@ export function ConvertForm() {
<TextField
sx={{ width: "100%" }}
label="DAR(src) Directory"
placeholder="<MOD NAME>/DynamicAnimationReplacer/_CustomCondition/"
placeholder="[...]/<MOD NAME>"
required
value={value}
variant="outlined"
Expand All @@ -128,7 +133,20 @@ export function ConvertForm() {
onBlur={onBlur}
error={Boolean(error)}
helperText={
"Any path under a dir named DynamicAnimationReplacer can be specified."
<>
<p>
[Required] Path of dir containing
&quot;DynamicAnimationReplacer&quot;.{" "}
</p>
<p>
&quot;C:\\[...]/Mod Name/&quot; -&gt; Convert 1st & 3rd
person
</p>
<p>
&quot;[...]/animations/DynamicAnimationReplacer/&quot;
-&gt; Convert only 3rd person
</p>
</>
}
/>
</Grid>
Expand Down Expand Up @@ -163,7 +181,7 @@ export function ConvertForm() {
onBlur={onBlur}
error={Boolean(error)}
helperText={
"A dir named meshes/actors/ will be created in the specified directory."
'[Optional] Creates a OAR path in specified directory.(e.g. "NewMod" -> "NewMod/meshes/[...])'
}
/>
</Grid>
Expand Down Expand Up @@ -200,9 +218,7 @@ export function ConvertForm() {
}}
onBlur={onBlur}
error={Boolean(error)}
helperText={
"Correspondence path that can change the priority number to your own section name instead of the dir name"
}
helperText={<MappingHelpBtn />}
/>
</Grid>

Expand Down Expand Up @@ -239,7 +255,7 @@ export function ConvertForm() {
onBlur={onBlur}
error={Boolean(error)}
helperText={
"Correspondence path that can change the priority number to your own section name instead of the dir name"
"[Optional] File path that helps map priority number to a section name."
}
/>
</Grid>
Expand Down Expand Up @@ -275,7 +291,7 @@ export function ConvertForm() {
}}
onBlur={onBlur}
error={Boolean(error)}
helperText={error?.message}
helperText={"[Optional]"}
/>
)}
/>
Expand All @@ -301,7 +317,7 @@ export function ConvertForm() {
}}
onBlur={onBlur}
error={Boolean(error)}
helperText={error?.message}
helperText={"[Optional]"}
/>
)}
/>
Expand Down Expand Up @@ -349,3 +365,28 @@ export function ConvertForm() {
</Grid>
);
}

function MappingHelpBtn() {
const handleMappingClick = () =>
open(
"https://github.com/SARDONYX-sard/dar-to-oar/wiki#what-is-the-mapping-file"
);

return (
<>
<p>
[Optional] File path that helps map priority number to a section name.
</p>
<p>
See {" "}
<a
style={{ cursor: "pointer", color: "#00c2ff" }}
onClick={handleMappingClick}
>
[What is the mapping file?]
</a>
(Jump to wiki)
</p>
</>
);
}
2 changes: 1 addition & 1 deletion frontend/src/components/log_file_btn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const LogFileButton = () => {
sx={{
marginTop: "9px",
width: "100%",
height: "80%",
height: "60%",
}}
variant="outlined"
onClick={async () => openLogFile().catch((e) => toast.error(`${e}`))}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/pages/converter.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use client";

import { ConvertForm } from "@/components/form";
import { useDynStyleWithStorage, useToastLimit } from "@/hooks";
import { useDynStyle, useToastLimit } from "@/hooks";
import { Box } from "@mui/material";
import { Toaster } from "react-hot-toast";

export default function Converter() {
useToastLimit(1);
useDynStyleWithStorage();
useDynStyle();

return (
<>
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/components/pages/settings.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"use client";

import { Box, TextField } from "@mui/material";
import { useDynStyle } from "@/hooks";
import { useDynStyle, useStorageState } from "@/hooks";
import { SelectStyleList } from "./../style_list";

export default function Settings() {
const [style, setStyle] = useDynStyle();
const [preset, setPreset] = useStorageState("presetNumber", "0");

return (
<Box
Expand All @@ -29,6 +30,8 @@ export default function Settings() {
multiline
onChange={(e) => {
setStyle(e.target.value);
localStorage.setItem("customCSS", e.target.value);
setPreset("0");
}}
placeholder="{ body: url('https://localhost' }"
value={style}
Expand All @@ -43,7 +46,11 @@ export default function Settings() {
maxHeight: "30%",
}}
>
<SelectStyleList setStyle={setStyle} />
<SelectStyleList
preset={preset}
setPreset={setPreset}
setStyle={setStyle}
/>
</Box>
</Box>
);
Expand Down
Loading

0 comments on commit 20a64c4

Please sign in to comment.