first style changes
This commit is contained in:
parent
b57d56c20a
commit
5b0f9ff816
@ -0,0 +1,22 @@
|
|||||||
|
.layout {
|
||||||
|
display: grid;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-weight: bold;
|
||||||
|
grid-column: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
grid-column: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stratType {
|
||||||
|
grid-column: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deleteButton {
|
||||||
|
grid-column: 4;
|
||||||
|
}
|
@ -41,16 +41,12 @@ const StratItem: Component<StratItemProps> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={styles.member}>
|
<div class={styles.layout}>
|
||||||
<div class={styles.memberDetails}>
|
<span class={styles.title} innerText={props.strat.title} onclick={() => navigate('/group/' + props.group.id + '/strat/' + props.strat.id)} />
|
||||||
<div class={styles.memberName} onclick={() => navigate('/group/' + props.group.id + '/strat/' + props.strat.id)}>
|
<span class={styles.description} innerText={props.strat.description} />
|
||||||
<span innerText={props.strat.title} />
|
<span class={styles.stratType} innerText={props.strat.stratType} />
|
||||||
<span innerText={props.strat.description} />
|
<div class={styles.deleteButton}>
|
||||||
<span innerText={props.strat.stratType} />
|
<button onClick={deleteMember}><BsTrash /></button>
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button onClick={deleteMember}><BsTrash /></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div >
|
</div >
|
||||||
)
|
)
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
.layout {
|
||||||
|
display: grid;
|
||||||
|
column-gap: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.strats {
|
||||||
|
grid-column-start: 1;
|
||||||
|
grid-column-end: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.members {
|
||||||
|
grid-column: 4;
|
||||||
|
}
|
@ -1,18 +1,13 @@
|
|||||||
import { useNavigate, useParams } from "@solidjs/router";
|
import { useNavigate, useParams } from "@solidjs/router";
|
||||||
import { Component, Show, createEffect, createSignal, onMount } from "solid-js";
|
import { Component, Show, createEffect, createSignal, onMount } from "solid-js";
|
||||||
|
|
||||||
import styles from './GroupPage.module.css'
|
import styles from './GroupPage.module.css';
|
||||||
import { Group, Map, Profile, Strat, User, api } from "../api";
|
import { Group, Map, Profile, Strat, User, api } from "../api";
|
||||||
import { showDialog, showInputDialog, showMessageDialog } from "../state";
|
import { showDialog, showInputDialog, showMessageDialog } from "../state";
|
||||||
import { _arrayBufferToBase64, addMap, addMember, addProfile, addStratType, errorToString, normalize } from "../util";
|
import { _arrayBufferToBase64, addMap, addMember, addStratType, errorToString, normalize } from "../util";
|
||||||
import { BsCheck2, BsPencil, BsTrash } from "solid-icons/bs";
|
import { BsCheck2, BsPencil, BsTrash } from "solid-icons/bs";
|
||||||
import { Collapse } from "solid-collapse";
|
|
||||||
import MemberItem from "../components/MemberItem";
|
import MemberItem from "../components/MemberItem";
|
||||||
import MapItem from "../components/MapItem";
|
|
||||||
import StratItem from "../components/StratItem";
|
import StratItem from "../components/StratItem";
|
||||||
import StratTypeItem from "../components/StratTypeItem";
|
|
||||||
import ProfileItem from "../components/ProfileItem";
|
|
||||||
import { UploadFile, createFileUploader } from "@solid-primitives/upload";
|
|
||||||
|
|
||||||
const GroupPage: Component = () => {
|
const GroupPage: Component = () => {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
@ -29,6 +24,12 @@ const GroupPage: Component = () => {
|
|||||||
const [profilesIsExpanded, setProfilesIsExpanded] = createSignal(false);
|
const [profilesIsExpanded, setProfilesIsExpanded] = createSignal(false);
|
||||||
const [stratTypesIsExpanded, setStratTypesIsExpanded] = createSignal(false);
|
const [stratTypesIsExpanded, setStratTypesIsExpanded] = createSignal(false);
|
||||||
|
|
||||||
|
const [filters, setFilters] = createSignal({
|
||||||
|
name: "",
|
||||||
|
Map: "All",
|
||||||
|
stratType: "All"
|
||||||
|
});
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
try {
|
try {
|
||||||
setGroup(await api().getGroup(params.id));
|
setGroup(await api().getGroup(params.id));
|
||||||
@ -91,8 +92,9 @@ const GroupPage: Component = () => {
|
|||||||
name: 'description'
|
name: 'description'
|
||||||
}],
|
}],
|
||||||
onDismiss: async () => {
|
onDismiss: async () => {
|
||||||
const strat = await api().addStrat(group().id, { title: title(), description: description(), stratType: stratType() });
|
const newGroup = await api().addStrat(group().id, { title: title(), description: description(), stratType: stratType() });
|
||||||
navigate('/group/' + group().id + '/strat/' + strat.id);
|
const strat = newGroup.strats.find(s => s.description === description() && s.title === title() && s.stratType === stratType());
|
||||||
|
navigate('/group/' + group().id + '/strat/' + strat!.id);
|
||||||
},
|
},
|
||||||
content: <select name="stratType" id="stratType">
|
content: <select name="stratType" id="stratType">
|
||||||
{group().stratTypes.map(p => <option value={p} onclick={() => setStratType(p)}>{p}</option>)}
|
{group().stratTypes.map(p => <option value={p} onclick={() => setStratType(p)}>{p}</option>)}
|
||||||
@ -132,6 +134,21 @@ const GroupPage: Component = () => {
|
|||||||
setGroup({ ...group(), profiles: [...group().profiles.filter(p => p.id !== profile.id)] });
|
setGroup({ ...group(), profiles: [...group().profiles.filter(p => p.id !== profile.id)] });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleFilters = (filter: string, val: any) => {
|
||||||
|
if (val === "Add") {
|
||||||
|
switch (filter) {
|
||||||
|
case "Map":
|
||||||
|
addMap(group(), (g) => setGroup(g));
|
||||||
|
break;
|
||||||
|
case "StratType":
|
||||||
|
addStratType(group(), (g) => setGroup(g));
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setFilters({ ...filters(), [filter]: val });
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Show when={!loading()} fallback={<div>Loading...</div>}>
|
<Show when={!loading()} fallback={<div>Loading...</div>}>
|
||||||
@ -144,46 +161,30 @@ const GroupPage: Component = () => {
|
|||||||
<button class={styles.editButton} onClick={toggleEdit}>{editing() ? <BsCheck2 /> : <BsPencil />}</button>
|
<button class={styles.editButton} onClick={toggleEdit}>{editing() ? <BsCheck2 /> : <BsPencil />}</button>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div>
|
<div class={styles.layout}>
|
||||||
<button onClick={() => setMembersIsExpanded(!membersIsExpanded())}>Members</button>
|
<div class={styles.strats}>
|
||||||
<button class={styles.addMemberButton} onClick={async () => addMember(group(), (g) => setGroup(g))}>+</button>
|
<h3>Strats <button class={styles.addStratButton} onClick={() => createStrat()}>Add</button></h3>
|
||||||
<Collapse value={membersIsExpanded()} class={styles.members}>
|
<div class={styles.filter}>
|
||||||
<div class={styles.groupMembers}>
|
Filter <br />
|
||||||
{group().members?.map(m => <MemberItem group={group()} member={m} onDelete={onDeleteMember} />)}
|
<input name="name" type="text" placeholder="Strat Name"></input>
|
||||||
|
<select name="Map" onInput={e => handleFilters(e.target.name, e.target.value)}>
|
||||||
|
<option value={"All"} >Map</option>
|
||||||
|
{group().maps.map(m => <option value={m.id}>{m.name}</option>)}
|
||||||
|
<option value={"Add"} >Add</option>
|
||||||
|
</select>
|
||||||
|
<select name="StratType" onInput={e => handleFilters(e.target.name, e.target.value)}>
|
||||||
|
<option value={"All"} >Strat Type</option>
|
||||||
|
{group().stratTypes.map(s => <option value={s}>{s}</option>)}
|
||||||
|
<option value={"Add"} >Add</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Collapse>
|
{group().strats.map(s => <StratItem group={group()} onDelete={onDeleteStrat} strat={s} />)}
|
||||||
<br />
|
</div>
|
||||||
<button onClick={() => setStratsIsExpanded(!stratsIsExpanded())}>strats</button>
|
<div class={styles.members}>
|
||||||
<button class={styles.addStratButton} onClick={() => createStrat()}>+</button>
|
<h3>Member <button class={styles.addMemberButton} onClick={async () => addMember(group(), (g) => setGroup(g))}>Add</button></h3>
|
||||||
<Collapse value={stratsIsExpanded()} class={styles.strats}>
|
{group().members.map(m => <MemberItem group={group()} member={m} onDelete={onDeleteMember} />)}
|
||||||
<div class={styles.strats}>
|
</div>
|
||||||
{group().strats?.map(s => <StratItem group={group()} strat={s} onDelete={onDeleteStrat} />)}
|
|
||||||
</div>
|
|
||||||
</Collapse>
|
|
||||||
<br />
|
|
||||||
<button onClick={() => setMapsIsExpanded(!mapsIsExpanded())}>maps</button>
|
|
||||||
<button class={styles.addMapButton} onClick={async () => addMap(group(), (g) => setGroup(g))}>+</button>
|
|
||||||
<Collapse value={mapsIsExpanded()} class={styles.maps}>
|
|
||||||
<div class={styles.maps}>
|
|
||||||
{group().maps?.map(m => <MapItem group={group()} map={m} onDelete={onDeleteMap} />)}
|
|
||||||
</div>
|
|
||||||
</Collapse>
|
|
||||||
<br />
|
|
||||||
<button onClick={() => setStratTypesIsExpanded(!stratTypesIsExpanded())}>strat types</button>
|
|
||||||
<button class={styles.addMemberButton} onClick={async () => addStratType(group(), (g) => setGroup(g))}>+</button>
|
|
||||||
<Collapse value={stratTypesIsExpanded()} class={styles.stratTypes}>
|
|
||||||
<div class={styles.stratTypes}>
|
|
||||||
{group().stratTypes?.map(s => <StratTypeItem group={group()} stratType={s} onDelete={onDeleteStratType} />)}
|
|
||||||
</div>
|
|
||||||
</Collapse>
|
|
||||||
<br />
|
|
||||||
<button onClick={() => setProfilesIsExpanded(!profilesIsExpanded())}>profiles</button>
|
|
||||||
<button class={styles.addMemberButton} onClick={async () => addProfile(group(), (g) => setGroup(g))}>+</button>
|
|
||||||
<Collapse value={profilesIsExpanded()} class={styles.profiles}>
|
|
||||||
<div class={styles.profiles}>
|
|
||||||
{group().profiles?.map(p => <ProfileItem group={group()} profile={p} onDelete={onDeleteProfile} />)}
|
|
||||||
</div>
|
|
||||||
</Collapse>
|
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</>
|
</>
|
||||||
|
@ -2,7 +2,7 @@ import { Component, For, Show, createSignal } from "solid-js";
|
|||||||
|
|
||||||
import GroupItem from '../components/GroupItem'
|
import GroupItem from '../components/GroupItem'
|
||||||
|
|
||||||
import styles from './Groups.module.css'
|
import styles from './Groups.module.css';
|
||||||
import { useNavigate } from "@solidjs/router";
|
import { useNavigate } from "@solidjs/router";
|
||||||
import { Group, api } from "../api";
|
import { Group, api } from "../api";
|
||||||
import { localState, showMessageDialog } from "../state";
|
import { localState, showMessageDialog } from "../state";
|
||||||
|
Loading…
Reference in New Issue
Block a user