-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.36.0 update See merge request technical-study/flash_anzan_web!41
- Loading branch information
Showing
23 changed files
with
311 additions
and
134 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
repo_root=$(cd "$(dirname "${BASH_SOURCE:-$0}")/.." && pwd) | ||
|
||
# | ||
# Update version of files such as package.json Cargo.toml | ||
# | ||
function main() { | ||
local version | ||
version=$1 | ||
|
||
if [[ -z "$version" ]]; then | ||
echo 'version number is not passed' | ||
return 1 | ||
fi | ||
if ! [[ "$version" =~ ^([0-9]+\.)+[0-9]+ ]]; then | ||
echo 'version number is invalid' | ||
return 1 | ||
fi | ||
|
||
pushd "$repo_root" || return 1 | ||
|
||
# package.json, package-lock.json | ||
sed -i -Ee 's/^(\s+"version": ")([0-9]+\.)+[0-9]+(")/\1'"$version"'\3/' package.json | ||
npm i --package-lock-only | ||
|
||
pushd src-tauri || return 1 | ||
|
||
# Cargo.toml, Cargo.lock | ||
sed -i -Ee 's/^(version = ")([0-9]+\.)+[0-9]+(")/\1'"$version"'\3/' Cargo.toml | ||
cargo generate-lockfile | ||
|
||
popd || return 1 | ||
popd || return 1 | ||
} | ||
|
||
main "$@" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { htmlElements } from '../dom/htmlElement.js' | ||
|
||
const errorMessageMap = { | ||
difficultyNotSupported: '難易度設定がサポートされていない桁数です', | ||
} as const | ||
|
||
type ErrorMessageMapKey = keyof typeof errorMessageMap | ||
|
||
export class ErrorMessage { | ||
private readonly htmlElement: HTMLDivElement | ||
private readonly errorsActivated: { [key in ErrorMessageMapKey]: boolean } = { | ||
difficultyNotSupported: false, | ||
} | ||
|
||
constructor(htmlElement: HTMLDivElement) { | ||
this.htmlElement = htmlElement | ||
} | ||
|
||
private render(): void { | ||
const messages = (Object.keys(this.errorsActivated) as ErrorMessageMapKey[]) | ||
.map((key) => { | ||
return this.errorsActivated[key] ? errorMessageMap[key] : null | ||
}) | ||
.filter((message) => message !== null) | ||
if (messages.length > 0) { | ||
this.htmlElement.classList.remove('d-none') | ||
} else { | ||
this.htmlElement.classList.add('d-none') | ||
} | ||
this.htmlElement.innerHTML = messages.join('<br>') | ||
} | ||
|
||
addError(key: ErrorMessageMapKey): void { | ||
this.errorsActivated[key] = true | ||
this.render() | ||
} | ||
|
||
removeError(key: ErrorMessageMapKey): void { | ||
this.errorsActivated[key] = false | ||
this.render() | ||
} | ||
} | ||
|
||
export const errorMessage = new ErrorMessage(htmlElements.errorMessage) |
Oops, something went wrong.