Spaces:
Running
Running
Delete src/components/components
Browse files
src/components/components/CustomModal.scss
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
// src/components/CustomModal.scss
|
2 |
-
.modal-overlay {
|
3 |
-
position: fixed; top: 0; left: 0; right: 0; bottom: 0;
|
4 |
-
background-color: rgba(0, 0, 0, 0.7);
|
5 |
-
display: flex; align-items: center; justify-content: center;
|
6 |
-
z-index: 1000; backdrop-filter: blur(5px);
|
7 |
-
}
|
8 |
-
.modal-content {
|
9 |
-
background: #2c2c2e; padding: 24px; border-radius: 16px;
|
10 |
-
width: 90%; max-width: 500px;
|
11 |
-
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
|
12 |
-
border: 1px solid rgba(255, 255, 255, 0.15);
|
13 |
-
animation: modal-fade-in 0.3s ease-out;
|
14 |
-
.modal-header {
|
15 |
-
display: flex; justify-content: space-between; align-items: center;
|
16 |
-
margin-bottom: 20px; border-bottom: 1px solid #444; padding-bottom: 16px;
|
17 |
-
h3 { margin: 0; font-size: 20px; color: #fff; }
|
18 |
-
.close-button {
|
19 |
-
background: none; border: none; color: #aaa; font-size: 28px;
|
20 |
-
cursor: pointer; line-height: 1; padding: 0;
|
21 |
-
&:hover { color: #fff; }
|
22 |
-
}
|
23 |
-
}
|
24 |
-
.modal-body .form-group {
|
25 |
-
margin-bottom: 20px;
|
26 |
-
label { display: block; margin-bottom: 8px; font-weight: 500; color: #e0e0e0; }
|
27 |
-
input, textarea {
|
28 |
-
width: 100%; padding: 12px; border-radius: 8px;
|
29 |
-
border: 1px solid #555; background-color: #3a3a3c;
|
30 |
-
color: #fff; font-size: 15px;
|
31 |
-
&:focus {
|
32 |
-
outline: none; border-color: #0a84ff;
|
33 |
-
box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.5);
|
34 |
-
}
|
35 |
-
}
|
36 |
-
textarea { resize: vertical; min-height: 100px; }
|
37 |
-
small { display: block; margin-top: 8px; color: #999; font-size: 12px; }
|
38 |
-
}
|
39 |
-
.modal-footer {
|
40 |
-
display: flex; justify-content: flex-end; margin-top: 24px;
|
41 |
-
.save-button {
|
42 |
-
background-color: #0a84ff; color: #fff; border: none;
|
43 |
-
padding: 12px 24px; border-radius: 8px; font-size: 16px;
|
44 |
-
font-weight: 600; cursor: pointer; transition: background-color 0.2s;
|
45 |
-
&:hover { background-color: #3499ff; }
|
46 |
-
}
|
47 |
-
}
|
48 |
-
}
|
49 |
-
@keyframes modal-fade-in {
|
50 |
-
from { opacity: 0; transform: scale(0.9); }
|
51 |
-
to { opacity: 1; transform: scale(1); }
|
52 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/components/components/CustomModal.tsx
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
// src/components/CustomModal.tsx
|
2 |
-
import React, { useState, useEffect, FC } from 'react';
|
3 |
-
import './CustomModal.scss'; // استایلها را از فایل جداگانه ایمپورت میکند
|
4 |
-
|
5 |
-
interface CustomModalProps {
|
6 |
-
isOpen: boolean;
|
7 |
-
onClose: () => void;
|
8 |
-
onSave: (name: string, instructions: string) => void;
|
9 |
-
initialName: string;
|
10 |
-
initialInstructions: string;
|
11 |
-
}
|
12 |
-
|
13 |
-
export const CustomModal: FC<CustomModalProps> = ({ isOpen, onClose, onSave, initialName, initialInstructions }) => {
|
14 |
-
const [name, setName] = useState(initialName);
|
15 |
-
const [instructions, setInstructions] = useState(initialInstructions);
|
16 |
-
|
17 |
-
useEffect(() => {
|
18 |
-
if (isOpen) {
|
19 |
-
setName(initialName);
|
20 |
-
setInstructions(initialInstructions);
|
21 |
-
}
|
22 |
-
}, [isOpen, initialName, initialInstructions]);
|
23 |
-
|
24 |
-
if (!isOpen) return null;
|
25 |
-
|
26 |
-
const handleSave = () => {
|
27 |
-
if (name.trim() && instructions.trim()) {
|
28 |
-
onSave(name.trim(), instructions.trim());
|
29 |
-
onClose();
|
30 |
-
} else {
|
31 |
-
alert("لطفا نام و دستورالعملها را وارد کنید.");
|
32 |
-
}
|
33 |
-
};
|
34 |
-
|
35 |
-
return (
|
36 |
-
<div className="modal-overlay" onClick={onClose}>
|
37 |
-
<div className="modal-content" onClick={(e) => e.stopPropagation()}>
|
38 |
-
<div className="modal-header">
|
39 |
-
<h3>ساخت شخصیت اختصاصی</h3>
|
40 |
-
<button className="close-button" onClick={onClose}>×</button>
|
41 |
-
</div>
|
42 |
-
<div className="modal-body">
|
43 |
-
<div className="form-group">
|
44 |
-
<label htmlFor="name">نام شما (برای صدا زدن)</label>
|
45 |
-
<input id="name" type="text" placeholder="مثلا: علی" value={name} onChange={(e) => setName(e.target.value)} />
|
46 |
-
</div>
|
47 |
-
<div className="form-group">
|
48 |
-
<label htmlFor="instructions">دستورالعملهای شخصیت</label>
|
49 |
-
<textarea id="instructions" placeholder="مثلا: خیلی خودمونی و بامزه صحبت کن..." value={instructions} onChange={(e) => setInstructions(e.target.value)} rows={6} />
|
50 |
-
<small>اینجا فقط رفتار و سبک صحبت کردن دستیار را مشخص کنید.</small>
|
51 |
-
</div>
|
52 |
-
</div>
|
53 |
-
<div className="modal-footer">
|
54 |
-
<button className="save-button" onClick={handleSave}>ذخیره و فعالسازی</button>
|
55 |
-
</div>
|
56 |
-
</div>
|
57 |
-
</div>
|
58 |
-
);
|
59 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|