update readme and add .vscode
This commit is contained in:
parent
ebc0616ba1
commit
59adc0f698
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Wails: Debug myproject",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "exec",
|
||||
"program": "${workspaceFolder}/build/bin/vscode",
|
||||
"preLaunchTask": "build",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {}
|
||||
}
|
||||
]
|
||||
}
|
23
.vscode/tasks.json
vendored
Normal file
23
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
|
||||
{
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"command": "go",
|
||||
"args": [
|
||||
"build",
|
||||
"-tags",
|
||||
"dev",
|
||||
"-gcflags",
|
||||
"all=-N -l",
|
||||
"-o",
|
||||
"build/bin/vscode"
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
57
README.md
57
README.md
@ -63,3 +63,60 @@ if err != nil {
|
||||
required
|
||||
/>
|
||||
```
|
||||
|
||||
### File Selector:
|
||||
```go
|
||||
import (
|
||||
"os"
|
||||
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
func (a *App) MakeFile() {
|
||||
dirname, _ := os.UserHomeDir()
|
||||
str, err := runtime.SaveFileDialog(a.ctx, runtime.SaveDialogOptions{DefaultDirectory: dirname, DefaultFilename: "filename.csv"})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
file, err := os.Create(str)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
}
|
||||
```
|
||||
|
||||
### Radio button for bool
|
||||
|
||||
|
||||
``` svelte
|
||||
<script lang="ts">
|
||||
let isTeam: bool = $state(0)
|
||||
let _isTeam:int = $state(0)
|
||||
$effect(() => {
|
||||
if (isTeam) {
|
||||
_isTeam = 1;
|
||||
} else {
|
||||
_isTeam = 0;
|
||||
}
|
||||
});
|
||||
$effect(() => {
|
||||
if (isTeam != (_isTeam === 1)) {
|
||||
isTeam = _isTeam === 1;
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<div class="m-5 grid grid-cols-3">
|
||||
<Label>Type:</Label>
|
||||
<Radio
|
||||
required
|
||||
value={0}
|
||||
bind:group={_isTeam}
|
||||
>Single Player</Radio
|
||||
>
|
||||
<Radio required value={1} bind:group={_isTeam}>Team</Radio>
|
||||
</div>
|
||||
|
||||
```
|
||||
|
20
frontend/src/components/TimeInput.svelte
Normal file
20
frontend/src/components/TimeInput.svelte
Normal file
@ -0,0 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { Input } from "flowbite-svelte";
|
||||
|
||||
let { value }: { value: Date } = $props();
|
||||
|
||||
const formatDateTimeLocal = (date: Date) => {
|
||||
const pad = (num) => num.toString().padStart(2, "0");
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||
};
|
||||
</script>
|
||||
|
||||
<Input
|
||||
type="datetime-local"
|
||||
value={formatDateTimeLocal(value)}
|
||||
onchange={(e) => {
|
||||
// @ts-ignore
|
||||
value = new Date(e.target.value);
|
||||
}}
|
||||
required
|
||||
/>
|
Loading…
x
Reference in New Issue
Block a user