Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc frontend tweaks & fixes #857

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hunts/src/AddPuzzleModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function AddPuzzleModal({ huntId }: { huntId: HuntId }) {
</Form.Group>
<Form.Check
type="checkbox"
label="Is meta"
label="This is a meta"
id="is-meta-checkbox"
checked={isMeta}
onChange={(e: ChangeEvent) => setIsMeta(e.target.checked)}
Expand Down
16 changes: 10 additions & 6 deletions hunts/src/EditPuzzleModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function EditPuzzleModal({
const dispatch = useDispatch<Dispatch>();

const tags = useSelector(selectPuzzleTags);
const meta_tags = tags.filter((tag) => tag.is_meta && tag.name != name);

const onSubmit = (e: FormEvent) => {
e.preventDefault();
Expand Down Expand Up @@ -79,16 +80,11 @@ function EditPuzzleModal({
</Form.Group>
<Form.Check
type="checkbox"
label="Is meta"
label="This is a meta"
id="is-meta-checkbox"
checked={newIsMeta}
onChange={(e: ChangeEvent) => setNewIsMeta(e.target.checked)}
/>
<h5 style={{ textAlign: "center" }}>Parent Metas</h5>
<EditableTagList
puzzleId={puzzleId}
tags={tags.filter((tag) => tag.is_meta && tag.name != name)}
/>
<Form.Check
type="checkbox"
label="Create discord channels"
Expand All @@ -98,6 +94,14 @@ function EditPuzzleModal({
// If channel is already created, disable its deletion
disabled={hasChannels}
/>
{meta_tags.length > 0 ? (
<>
<h5 style={{ textAlign: "center" }}>Parent Metas</h5>
<EditableTagList
puzzleId={puzzleId}
tags={tags.filter((tag) => tag.is_meta && tag.name != name)}
rgossiaux marked this conversation as resolved.
Show resolved Hide resolved
/>
</>) : undefined}
</Modal.Body>
<Modal.Footer>
<Button
Expand Down
18 changes: 5 additions & 13 deletions hunts/src/NotesCell.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
import React, { useState } from "react";
import { useSelector, useDispatch } from "react-redux";
import { useDispatch } from "react-redux";
import { editNotes } from "./puzzlesSlice";

import type { Dispatch, RootState } from "./store";
import type { Hunt, Row } from "./types";
import type { Dispatch } from "./store";
import type { Row } from "./types";

export default function NotesCell({ row, value }: { row: Row; value: string }) {
const { id: huntId } = useSelector<RootState, Hunt>((state) => state.hunt);
const [uiHovered, setUiHovered] = useState(false);
const [ editing, setEditing ] = useState(false);
const [ editedNotesValue, setEditedNotesValue ] = useState(value);
const dispatch = useDispatch<Dispatch>();

return (
<div
className="clickable-puzzle-cell"
onMouseEnter={() => {
setUiHovered(true);
}}
onMouseLeave={() => {
setUiHovered(false);
}}
className={!editing ? "clickable-puzzle-cell" : ""}
onClick={() => {
if (!editing) {
setEditing(true);
Expand All @@ -33,7 +25,7 @@ export default function NotesCell({ row, value }: { row: Row; value: string }) {
<textarea
autoFocus
value={editedNotesValue}
style={{ minHeight: '70px' }}
style={{ minHeight: '70px', width: '100%' }}
onChange={(e) => {
setEditedNotesValue(e.target.value);
}}
Expand Down
Loading