ticket 16, 4, 18, 19, 20, 21, 22
Some checks failed
publish-main / release-image (push) Has been cancelled
Some checks failed
publish-main / release-image (push) Has been cancelled
This commit is contained in:
@ -26,7 +26,8 @@ const AnswerModal = ({
|
||||
setComment,
|
||||
setCurrentTypeAnswer,
|
||||
setFile,
|
||||
removeOptionAnswer
|
||||
removeOptionAnswer,
|
||||
addFiles
|
||||
}) => {
|
||||
|
||||
return (
|
||||
@ -45,13 +46,15 @@ const AnswerModal = ({
|
||||
<div className={classes.myModal__dialog__content__body__answer}>
|
||||
<span className={classes.myModal__dialog__content__body__answer__title}>Вопрос</span>
|
||||
<MarkDowm mkValue={question} setMkValue={setQuestion}></MarkDowm>
|
||||
<label for="fileUpload" className={classes.myModal__dialog__content__body__answer__fileLabel}>Добавить файл</label>
|
||||
<label for="fileUpload" className={classes.myModal__dialog__content__body__answer__listFile}>Файлы : {file ? file.map(item => `${item.name}; `) : Нет}</label>
|
||||
<input
|
||||
id="fileUpload"
|
||||
type="file"
|
||||
multiple
|
||||
accept="image/*,image/jpeg,video/mp4,video/x-m4v,video/*"
|
||||
className={classes.myModal__dialog__content__body__answer__file}
|
||||
value={file}
|
||||
onChange={event => setFile(event.target.value)}
|
||||
onChange={e => addFiles(e.target.files)}
|
||||
></input>
|
||||
</div>
|
||||
<div className={classes.myModal__dialog__content__body__comment}>
|
||||
|
@ -5,14 +5,13 @@ import MyButton from "./MyButton.jsx";
|
||||
|
||||
const DefaultModal = ({
|
||||
name,
|
||||
postfix,
|
||||
btn,
|
||||
BodyModal
|
||||
}) => {
|
||||
|
||||
return (
|
||||
<div class="modal fade myModal" className={classes.main} id={`${name}`} tabIndex="-1" aria-labelledby="exampleModalLabel" data-bs-backdrop="static" aria-hidden="true">
|
||||
<div class="modal-dialog myModal__dialog" className={classes.main__dialog}>
|
||||
<div class="modal-dialog modal-dialog-centered myModal__dialog" className={classes.main__dialog}>
|
||||
<div class="modal-content" className={classes.main__dialog__content}>
|
||||
{BodyModal}
|
||||
<div class="modal-footer myModal__dialog__content__footer" className={classes.myModal__dialog__content__footer}>
|
||||
|
@ -4,11 +4,23 @@ import MarkdownEditor from "@uiw/react-markdown-editor";
|
||||
import { parseTotalLinkVideo } from "../hooks/sundry/parseLinkVideo";
|
||||
|
||||
const GeneratingFormFields = ({listBlock, listTypeAnswer, answers, updateAnswersForm}) => {
|
||||
|
||||
const getUint8Array = (binary) => {
|
||||
let bytesArray = []
|
||||
let len = binary.length
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
bytesArray.push(binary.charCodeAt(i))
|
||||
}
|
||||
|
||||
return [new Uint8Array(bytesArray)]
|
||||
}
|
||||
|
||||
return (
|
||||
listBlock.map((item, i) =>
|
||||
<div className={classes.item} key={i}>
|
||||
<div className={classes.item__question}>
|
||||
<p className={classes.item__question__text}>{i + 1}) <MarkdownEditor.Markdown source={item.question}/></p>
|
||||
<p className={classes.item__question__text}><MarkdownEditor.Markdown source={`${i + 1}) ${item.question}`}/></p>
|
||||
<p className={classes.item__question__comment}>{item.comment}</p>
|
||||
<div className={classes.item__question__video}>
|
||||
{item.video ?
|
||||
@ -37,6 +49,13 @@ const GeneratingFormFields = ({listBlock, listTypeAnswer, answers, updateAnswers
|
||||
updateAnswersForm: updateAnswersForm ? updateAnswersForm : false
|
||||
})
|
||||
}
|
||||
{
|
||||
item.file.map(f => <a className={classes.item__answer__file} download={f.name} href={
|
||||
URL.createObjectURL(
|
||||
new Blob(getUint8Array(atob(f.binary)), { type: f.type })
|
||||
)
|
||||
}>{f.name}</a>)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
@ -1,16 +1,28 @@
|
||||
import React from "react";
|
||||
import { InputMask } from "primereact/inputmask";
|
||||
import classes from "../assets/styles/components/myInput.module.scss";
|
||||
|
||||
const MyInput = (props) => {
|
||||
return (
|
||||
<div className={classes.main} style={{...props.otherMainStyle}}>
|
||||
<input
|
||||
type={props.type}
|
||||
placeholder={props.placeholder}
|
||||
style={{...props.otherInputStyle}}
|
||||
onChange={(e) => props.change(e.target.value)}
|
||||
value={props.value}
|
||||
/>
|
||||
{
|
||||
props.mask ?
|
||||
<InputMask
|
||||
type={props.type}
|
||||
placeholder={props.placeholder}
|
||||
style={{...props.otherInputStyle}}
|
||||
onChange={(e) => props.change(e.target.value)}
|
||||
value={props.value}
|
||||
mask={props.mask}
|
||||
/> :
|
||||
<input
|
||||
type={props.type}
|
||||
placeholder={props.placeholder}
|
||||
style={{...props.otherInputStyle}}
|
||||
onChange={(e) => props.change(e.target.value)}
|
||||
value={props.value}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
11
src/components/MyQrCode.jsx
Normal file
11
src/components/MyQrCode.jsx
Normal file
@ -0,0 +1,11 @@
|
||||
import React from "react";
|
||||
import QRCode from "react-qr-code";
|
||||
|
||||
|
||||
const MyQrCode = ({value}) => {
|
||||
return (
|
||||
<QRCode value={value}/>
|
||||
)
|
||||
}
|
||||
|
||||
export default MyQrCode
|
@ -3,6 +3,33 @@ import { CKEditor } from '@ckeditor/ckeditor5-react';
|
||||
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
|
||||
|
||||
const TextEditor = ({data, setData}) => {
|
||||
|
||||
function uploadAdapter(loader) {
|
||||
return {
|
||||
upload: () => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const file = await loader.file;
|
||||
const buff = await file.arrayBuffer()
|
||||
const bytesArray = new Uint8Array(buff)
|
||||
const bytesString = btoa(String.fromCharCode.apply(null, bytesArray))
|
||||
resolve({
|
||||
default: `data:image/jpg;base64, ${bytesString}`
|
||||
});
|
||||
} catch (error) {
|
||||
reject("Hello");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function uploadPlugin(editor) {
|
||||
editor.plugins.get("FileRepository").createUploadAdapter = (loader) => {
|
||||
return uploadAdapter(loader);
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<h2>Редактор статьи</h2>
|
||||
@ -10,6 +37,7 @@ const TextEditor = ({data, setData}) => {
|
||||
editor={ ClassicEditor }
|
||||
data={data}
|
||||
config = {{
|
||||
extraPlugins: [uploadPlugin],
|
||||
mediaEmbed: {previewsInData: true }
|
||||
}}
|
||||
onReady={ editor => {
|
||||
@ -19,15 +47,11 @@ const TextEditor = ({data, setData}) => {
|
||||
onChange={ ( event, editor ) => {
|
||||
setData(editor.getData())
|
||||
}}
|
||||
onBlur={ ( event, editor ) => {
|
||||
console.log( 'Blur.', editor );
|
||||
} }
|
||||
onFocus={ ( event, editor ) => {
|
||||
console.log( 'Focus.', editor );
|
||||
} }
|
||||
onBlur={ ( event, editor ) => {}}
|
||||
onFocus={ ( event, editor ) => {}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default TextEditor;
|
||||
export default TextEditor
|
14
src/components/bodyModal/EditToken.jsx
Normal file
14
src/components/bodyModal/EditToken.jsx
Normal file
@ -0,0 +1,14 @@
|
||||
import React from "react";
|
||||
import classes from "../../assets/styles/components/bodyModal/editToken.module.scss";
|
||||
import MyInput from "../MyInput.jsx";
|
||||
|
||||
|
||||
const EditToken = ({titleToken, setTitleToken}) => {
|
||||
return (
|
||||
<div className={classes.main}>
|
||||
<MyInput type={"text"} value={titleToken} change={setTitleToken} placeholder={"Название"}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default EditToken
|
@ -1,4 +1,4 @@
|
||||
import React, {useState} from "react";
|
||||
import React, {useState, useRef} from "react";
|
||||
import classes from "../../assets/styles/components/bodyModal/editUserAdminPanel.module.scss";
|
||||
import MyInput from "../../components/MyInput.jsx";
|
||||
|
||||
@ -12,6 +12,7 @@ const EditUserAdminPanel = ({
|
||||
lastName,
|
||||
login,
|
||||
phone,
|
||||
pass,
|
||||
setEmail,
|
||||
setFirstName,
|
||||
setIsAdmin,
|
||||
@ -19,10 +20,9 @@ const EditUserAdminPanel = ({
|
||||
setLastName,
|
||||
setLogin,
|
||||
setPhone,
|
||||
setPass
|
||||
}) => {
|
||||
|
||||
console.log('228', id, isAdmin, isAdmin)
|
||||
|
||||
return (
|
||||
<div className={classes.main}>
|
||||
<MyInput
|
||||
@ -35,6 +35,7 @@ const EditUserAdminPanel = ({
|
||||
/>
|
||||
<MyInput
|
||||
type={"text"}
|
||||
mask={"9 (999) 999-99-99"}
|
||||
value={phone}
|
||||
placeholder={"Телефон"}
|
||||
change={setPhone}
|
||||
@ -65,6 +66,14 @@ const EditUserAdminPanel = ({
|
||||
otherMainStyle={{width: "100%", height: "100%", marginTop: "1%"}}
|
||||
otherInputStyle={{width: "100%", height: "10%"}}
|
||||
/>
|
||||
<MyInput
|
||||
type={"text"}
|
||||
value={pass}
|
||||
placeholder={"Пароль"}
|
||||
change={setPass}
|
||||
otherMainStyle={{width: "100%", height: "100%", marginTop: "1%"}}
|
||||
otherInputStyle={{width: "100%", height: "10%"}}
|
||||
/>
|
||||
<div className={classes.main__status}>
|
||||
<div className={classes.main__status__admin}>
|
||||
<div className={classes.main__status__admin__text}>Администратор</div>
|
||||
|
14
src/components/bodyModal/QrCodeToken.jsx
Normal file
14
src/components/bodyModal/QrCodeToken.jsx
Normal file
@ -0,0 +1,14 @@
|
||||
import React from "react";
|
||||
import classes from "../../assets/styles/components/bodyModal/qrCodeToken.module.scss";
|
||||
import MyQrCode from "../MyQrCode.jsx";
|
||||
|
||||
|
||||
const QrCodeToken = ({value}) => {
|
||||
return (
|
||||
<div className={classes.main}>
|
||||
<MyQrCode value={`http://localhost:3000/forms/${value}`}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default QrCodeToken
|
Reference in New Issue
Block a user