added event-editor-submit through ctrl+enter in description
This commit is contained in:
10
client/package-lock.json
generated
10
client/package-lock.json
generated
@@ -11,6 +11,7 @@
|
||||
"@carbon/icons-react": "^11.53.0",
|
||||
"@heroui/react": "^2.6.14",
|
||||
"@internationalized/date": "3.6.0",
|
||||
"@mantine/hooks": "^7.16.2",
|
||||
"@react-aria/i18n": "^3.12.4",
|
||||
"@react-stately/data": "^3.12.0",
|
||||
"framer-motion": "^12.0.0",
|
||||
@@ -2494,6 +2495,15 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@mantine/hooks": {
|
||||
"version": "7.16.2",
|
||||
"resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.16.2.tgz",
|
||||
"integrity": "sha512-ZFHQhDi9T+r6VR5NEeE47gigPPIAHVIKDOCWsCsbCqHc3yz5l8kiO2RdfUmsTKV2KD/AiXnAw4b6pjQEP58GOg==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"react": "^18.x || ^19.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/env": {
|
||||
"version": "15.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-15.1.5.tgz",
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@internationalized/date": "3.6.0",
|
||||
"@carbon/icons-react": "^11.53.0",
|
||||
"@heroui/react": "^2.6.14",
|
||||
"@internationalized/date": "3.6.0",
|
||||
"@mantine/hooks": "^7.16.2",
|
||||
"@react-aria/i18n": "^3.12.4",
|
||||
"@react-stately/data": "^3.12.0",
|
||||
"framer-motion": "^12.0.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from "react";
|
||||
import React, { useRef, useState } from "react";
|
||||
import {
|
||||
getLocalTimeZone,
|
||||
now,
|
||||
@@ -21,6 +21,7 @@ import { EventData } from "@/Zustand";
|
||||
import { useAsyncList } from "@react-stately/data";
|
||||
import { getTasks } from "@/lib";
|
||||
import Loading from "../Loading";
|
||||
import { getHotkeyHandler } from "@mantine/hooks";
|
||||
|
||||
export interface EventSubmitData {
|
||||
eventID: number;
|
||||
@@ -49,6 +50,7 @@ export default function EventEditor(props: {
|
||||
const [eventTasks, setEventTasks] = useState<string[]>(
|
||||
props.value?.tasks.map((k) => k.taskID.toString()) ?? [],
|
||||
);
|
||||
const submitButtonRef = useRef<HTMLButtonElement>(null);
|
||||
|
||||
const tasks = useAsyncList({
|
||||
async load() {
|
||||
@@ -108,6 +110,9 @@ export default function EventEditor(props: {
|
||||
name="description"
|
||||
value={description}
|
||||
onValueChange={setDescription}
|
||||
onKeyDown={getHotkeyHandler([
|
||||
["ctrl+Enter", () => submitButtonRef.current?.click()],
|
||||
])}
|
||||
/>
|
||||
<CheckboxGroup
|
||||
name="tasks"
|
||||
@@ -132,7 +137,10 @@ export default function EventEditor(props: {
|
||||
)}
|
||||
</CheckboxGroup>
|
||||
</ModalBody>
|
||||
<ModalFooter>{props.footer}</ModalFooter>
|
||||
<ModalFooter>
|
||||
<button ref={submitButtonRef} type="submit" className="hidden" />
|
||||
{props.footer}
|
||||
</ModalFooter>
|
||||
</ModalContent>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user