diff --git a/.gitignore b/.gitignore index 5b6275d..4e2467f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ # production /build +/extern/material-design-icons-4.0.0 # misc .DS_Store diff --git a/extern/material-design-icons-4.0.0.zip b/extern/material-design-icons-4.0.0.zip new file mode 100644 index 0000000..cff4b9e Binary files /dev/null and b/extern/material-design-icons-4.0.0.zip differ diff --git a/src/components/DndList.tsx b/src/components/DndList.tsx index 05560cd..0e03167 100644 --- a/src/components/DndList.tsx +++ b/src/components/DndList.tsx @@ -12,7 +12,8 @@ const useStyles = createStyles((theme) => ({ border: `1px solid ${ theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[2] }`, - padding: `${theme.spacing.xs}px ${theme.spacing.xl}px`, +// padding: `${theme.spacing.xs}px ${theme.spacing.xl}px`, + padding: `1px ${theme.spacing.xl}px`, backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.white, marginBottom: theme.spacing.sm, }, diff --git a/src/components/FileUpload.tsx b/src/components/FileUpload.tsx index 7545f2c..8246628 100644 --- a/src/components/FileUpload.tsx +++ b/src/components/FileUpload.tsx @@ -2,6 +2,7 @@ import { useState } from "react"; import { Link } from "react-router-dom"; import {upload as ApiUpload} from "../services/PhpApi"; import PreviewUpload from "./PreviewUpload"; +import './InputForm.css'; const FileUpload: React.FC = () => { @@ -10,11 +11,9 @@ const FileUpload: React.FC = () => const [message, setMessage] = useState(""); - const selectFile = (event: React.ChangeEvent) => + const selectFile = (pl: File) => { - const { files } = event.target; - const selectedFiles = files as FileList; - setCurrentFile(selectedFiles?.[0]); + setCurrentFile(pl); setProgress(0); }; @@ -53,16 +52,13 @@ const FileUpload: React.FC = () => return (
-
+
- {/* */}
-
+
diff --git a/src/components/InputForm.css b/src/components/InputForm.css index ac9ef27..22db617 100644 --- a/src/components/InputForm.css +++ b/src/components/InputForm.css @@ -4,6 +4,7 @@ form display: flex; flex-direction: column; align-items: flex-end; + text-align: left; } .InputForm @@ -29,7 +30,7 @@ form flex-direction: column; } -.InputForm button[type=submit] +.InputForm button, input { background-color: #aa0404; color: white; @@ -39,6 +40,7 @@ form height: 25px; max-width: 100%; width: auto; + margin-top: 5px; } .InputForm input diff --git a/src/components/PreviewUpload.tsx b/src/components/PreviewUpload.tsx index 030624f..dd4d427 100644 --- a/src/components/PreviewUpload.tsx +++ b/src/components/PreviewUpload.tsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import {getDog} from '../services/PhpApi'; import useSWR from 'swr'; +import { FileInput } from '@mantine/core'; function PreviewUpload({chgFile}:{chgFile: any}) { @@ -18,23 +19,12 @@ function PreviewUpload({chgFile}:{chgFile: any}) console.log(data); let file_loc: string | undefined = "./uploads"+ data.data.picture; - const handleChange = async ( - event: React.ChangeEvent - ): Promise => + const handleChangeFile = async (pl: File) => { - // const { target } = event; - // const img = new Image(); - const ImageName = event.target.value.split('\\')[2]; - const Image = event.target.value; - console.log('Image on Kevel: ', Image); // Image on Kevel - console.log('ImageName on Kevel: ', ImageName); // ImageName on Kevel - console.log('ImageLink on Kevel: ', event.target.value); // ImageLink on Kevel - console.log('event current Target files: ', event.target.files![0]); + console.log(pl); - const fileLoaded = URL.createObjectURL(event.target.files![0]); - const files = event.target.files; + const fileLoaded = URL.createObjectURL(pl); - console.log('files: ', files); const dimensions = await someFunction(fileLoaded); setDimensionWidth(dimensions.width); setDimensionHeight(dimensions.height); @@ -43,8 +33,9 @@ function PreviewUpload({chgFile}:{chgFile: any}) console.log('dimensions height: ', dimensions.height); setFile(fileLoaded); - chgFile(event); - }; + chgFile(pl); + } + const getHeightAndWidthFromDataUrl = (dataURL: string) => new Promise<{height: number, width: number}>((resolve) => { const img = new Image(); @@ -66,10 +57,14 @@ function PreviewUpload({chgFile}:{chgFile: any}) // return ( <> ); return ( -
- +
diff --git a/src/components/Profil.tsx b/src/components/Profil.tsx index b79db00..48fef22 100644 --- a/src/components/Profil.tsx +++ b/src/components/Profil.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useRef, useState } from 'react'; import useSWR from 'swr'; import { Link } from 'react-router-dom'; import toast, { Toaster } from 'react-hot-toast'; @@ -8,6 +8,7 @@ import CreateQr from '../services/CreateQr'; import Img from './Img'; import './InputForm.css'; import './Profil.css'; +import { TextInput } from '@mantine/core'; function Profil() { @@ -20,6 +21,9 @@ function Profil() // const { data, error, isLoading } = useSWR( user?.qr_id, getDog); const { data, error, isLoading, mutate } = useSWR( "profilData", getProfilData); + + const edit = useRef(false); + const formDataSave = useRef(formData); // just to fill it // data ist dogdata, logindata holt sich getProfilData.php aus $_SESSION if (error) return (
failed to load
); if (isLoading) return (
loading...
); @@ -55,15 +59,9 @@ function Profil() qr_code: '' }; - if (formData.email) + if (edit.current) { - formData_loc = - { - email: formData.email, - name: formData.name, - phone: formData.phone, - qr_code: formData.qr_code - }; + formData_loc = {...formDataSave.current}; // copy constructor } else { @@ -83,7 +81,9 @@ function Profil() ...formData_loc, [e.currentTarget.name]:e.currentTarget.value }; - setFormData(formData_loc); + setFormData(formData_loc); + edit.current = true; + formDataSave.current = {...formData_loc}; } function showData(data: any/*, e: React.FormEvent | React.MouseEvent*/) @@ -159,18 +159,32 @@ function Profil()
-
- - -
-
- - -
-
- - -
+ + +
diff --git a/src/components/Qr.tsx b/src/components/Qr.tsx index fd173e1..36d2a27 100644 --- a/src/components/Qr.tsx +++ b/src/components/Qr.tsx @@ -1,13 +1,13 @@ -import React, { ChangeEvent, MouseEventHandler, useState } from 'react' +import React, { MouseEventHandler, useState } from 'react' import { Link } from 'react-router-dom'; import { DogT } from '../context/UserContext'; import {getDog, updateQR} from '../services/PhpApi'; -//import Checkbox from './Checkbox'; import Img from './Img'; import './Qr.css'; +import './InputForm.css'; import useSWR from 'swr'; -import { MantineProvider, NumberInput, Stack, Checkbox } from '@mantine/core'; -import { NotificationsProvider, showNotification } from '@mantine/notifications'; +import { NumberInput, Stack, Checkbox, MantineProvider } from '@mantine/core'; +import { showNotification } from '@mantine/notifications'; import {DndList, DndListProps, TDataItem} from './DndList'; @@ -338,11 +338,15 @@ export default function Qr()
Reihenfolge
Ändern durch Drag'n Drop
- +
-
+
diff --git a/src/components/Register.tsx b/src/components/Register.tsx index b5c5f44..4f9386a 100644 --- a/src/components/Register.tsx +++ b/src/components/Register.tsx @@ -110,7 +110,7 @@ const Register = () => id="email" value={formData.email} required /> -
- - +