WIP
This commit is contained in:
@@ -70,19 +70,6 @@ body {
|
|||||||
--color-scrollbar-track: #00000022;
|
--color-scrollbar-track: #00000022;
|
||||||
}
|
}
|
||||||
|
|
||||||
.upload {
|
|
||||||
visibility: hidden;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.upload::before {
|
|
||||||
content: "UPLOAD PGN FILE";
|
|
||||||
visibility: visible;
|
|
||||||
display: inline-block;
|
|
||||||
text-align: center;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
button,
|
button,
|
||||||
.upload::before {
|
.upload::before {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Component, createSignal } from "solid-js";
|
import { Component, createSignal, Show } from "solid-js";
|
||||||
import { Handlers } from "../../types";
|
import { Handlers } from "../../types";
|
||||||
import readFile from "../../utils/readFile";
|
import readFile from "../../utils/readFile";
|
||||||
|
import { state } from "../../state";
|
||||||
import "./Load.css";
|
import "./Load.css";
|
||||||
|
|
||||||
const Load: Component<{ handlers: Handlers }> = (props) => {
|
const Load: Component<{ handlers: Handlers }> = (props) => {
|
||||||
@@ -8,6 +9,8 @@ const Load: Component<{ handlers: Handlers }> = (props) => {
|
|||||||
const [pgn, setPGN] = createSignal("");
|
const [pgn, setPGN] = createSignal("");
|
||||||
const [link, setLink] = createSignal("");
|
const [link, setLink] = createSignal("");
|
||||||
|
|
||||||
|
let filePicker: HTMLInputElement | undefined = undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="load">
|
<div class="load">
|
||||||
<input
|
<input
|
||||||
@@ -73,9 +76,10 @@ const Load: Component<{ handlers: Handlers }> = (props) => {
|
|||||||
</button>
|
</button>
|
||||||
<hr />
|
<hr />
|
||||||
<input
|
<input
|
||||||
class="upload load__pgn-file"
|
style={{ display: "none" }}
|
||||||
type="file"
|
type="file"
|
||||||
accept="application/vnd.chess-pgn,application/x-chess-pgn,.pgn"
|
accept="application/vnd.chess-pgn,application/x-chess-pgn,.pgn"
|
||||||
|
ref={filePicker}
|
||||||
onChange={async (e) => {
|
onChange={async (e) => {
|
||||||
const target = e.target as HTMLInputElement;
|
const target = e.target as HTMLInputElement;
|
||||||
if (target?.files && target.files.length > 0) {
|
if (target?.files && target.files.length > 0) {
|
||||||
@@ -84,10 +88,23 @@ const Load: Component<{ handlers: Handlers }> = (props) => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
></input>
|
></input>
|
||||||
|
<button
|
||||||
|
class="load__pgn-btn load__pgn-file"
|
||||||
|
onClick={() => {
|
||||||
|
if (filePicker) {
|
||||||
|
filePicker.click();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
UPLOAD PGN FILE
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<Show when={!state.mobile}>
|
||||||
<div className="load__pgn-file-info">
|
<div className="load__pgn-file-info">
|
||||||
<p>or</p>
|
<p>or</p>
|
||||||
<p>drop the PGN file anywhere on the page</p>
|
<p>drop the PGN file anywhere on the page</p>
|
||||||
</div>
|
</div>
|
||||||
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ const Share: Component<{ handlers: Handlers }> = (props) => {
|
|||||||
{copyId() === "fen-link" ? "Copied!" : "Copy link"}
|
{copyId() === "fen-link" ? "Copied!" : "Copy link"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<Show when={!state.mobile}>
|
|
||||||
<hr class="invisible" />
|
<hr class="invisible" />
|
||||||
<button
|
<button
|
||||||
classList={{
|
classList={{
|
||||||
@@ -182,7 +181,6 @@ const Share: Component<{ handlers: Handlers }> = (props) => {
|
|||||||
>
|
>
|
||||||
{imageRendering() ? "Please wait..." : "Save as image"}
|
{imageRendering() ? "Please wait..." : "Save as image"}
|
||||||
</button>
|
</button>
|
||||||
</Show>
|
|
||||||
</div>
|
</div>
|
||||||
<Show when={state.pgn}>
|
<Show when={state.pgn}>
|
||||||
<hr />
|
<hr />
|
||||||
@@ -244,7 +242,6 @@ const Share: Component<{ handlers: Handlers }> = (props) => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Show when={!state.mobile}>
|
|
||||||
<div class="share__animation">
|
<div class="share__animation">
|
||||||
<hr className="invisible" />
|
<hr className="invisible" />
|
||||||
<button
|
<button
|
||||||
@@ -335,7 +332,6 @@ const Share: Component<{ handlers: Handlers }> = (props) => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</Show>
|
|
||||||
</Scrollable>
|
</Scrollable>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user