Skip to content

Commit

Permalink
fix: turn sml version satisfactory version field to number
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Nov 15, 2023
1 parent 063401b commit 6edbe80
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use nix
use flake
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,5 @@ $RECYCLE.BIN/
/schema.graphql
/graphql.schema.json
/.svelte-kit
/.pnpm-store
/.pnpm-store
.direnv
75 changes: 75 additions & 0 deletions flake.lock

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

19 changes: 19 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
description = "smr-frontend";

inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs-unstable.url = "flake:nixpkgs/nixpkgs-unstable";
};

outputs = { self, nixpkgs, flake-utils, nixpkgs-unstable }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
unstable = nixpkgs-unstable.legacyPackages.${system}; in
{
devShells.default = import ./shell.nix { inherit pkgs unstable; };
}
);
}
5 changes: 1 addition & 4 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs, unstable }:

let
unstable = import (fetchTarball https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz) { };
in
pkgs.mkShell {
nativeBuildInputs = with pkgs.buildPackages; [
unstable.bun
Expand Down
7 changes: 5 additions & 2 deletions src/lib/components/sml-versions/SMLVersionForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
const { form, data, addField, unsetField } = createForm<SMLVersionData>({
initialValues: initialValues,
extend: [validator({ schema: smlVersionSchema }), reporter],
onSubmit: (submitted: SMLVersionData) => onSubmit(trimNonSchema(submitted, smlVersionSchema))
onSubmit: (submitted: SMLVersionData) => {
console.log('hello', submitted);
return onSubmit(trimNonSchema(submitted, smlVersionSchema));
}
});
const addTarget = () => {
Expand Down Expand Up @@ -60,7 +63,7 @@
<div class="grid grid-flow-row gap-2">
<label class="label">
<span>Satisfactory {$t('version')} *</span>
<input type="text" bind:value={$data.satisfactory_version} required class="input p-2" />
<input type="number" bind:value={$data.satisfactory_version} required class="input p-2" />
</label>
<ValidationMessage for="satisfactory_version" let:messages={message}>
<span class="validation-message">{message || ''}</span>
Expand Down
4 changes: 4 additions & 0 deletions src/routes/_global.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,7 @@ body.accessibility {
border-color: black !important;
color: black !important;
}

.validation-message {
color: red;
}

0 comments on commit 6edbe80

Please sign in to comment.