Compare commits

...

2 Commits

3 changed files with 141 additions and 79 deletions

View File

@ -3,9 +3,6 @@ import { useEffect, useState } from "react";
import { useNavigate, useLocation } from "react-router-dom"; import { useNavigate, useLocation } from "react-router-dom";
import LoginForm from "./LoginForm"; import LoginForm from "./LoginForm";
import RegisterForm from "./RegisterForm"; import RegisterForm from "./RegisterForm";
import { useDispatch } from "react-redux";
import { AppDispatch } from "../../store/store";
import { fetchUserDetails } from "../../store/slices/userSlice";
import LoginRegisterImg from "../../assets/illustration_1_.png"; import LoginRegisterImg from "../../assets/illustration_1_.png";
import SMELogo from "../../assets/SMELogo.png"; import SMELogo from "../../assets/SMELogo.png";
import api from "../../config/api"; import api from "../../config/api";
@ -75,7 +72,10 @@ function UserAuthUI() {
</div> </div>
{/* Right Side - Form */} {/* Right Side - Form */}
<div className="flex-1 flex items-center justify-center p-8 lg:p-12"> <div className="flex-1 flex-col sm:flex items-center justify-center p-8 lg:p-12">
<div className="h-[82px] sm:hidden w-full flex justify-center items-center p-4 bg-[var(--primary)] rounded-lg">
<img loading="lazy" height={50} src={SMELogo} alt="" />
</div>
{pageType === PAGE_TYPE_ENUM.LOGIN && <LoginForm onSwitchToRegister={() => navigate("/register")} />} {pageType === PAGE_TYPE_ENUM.LOGIN && <LoginForm onSwitchToRegister={() => navigate("/register")} />}
{pageType === PAGE_TYPE_ENUM.REGISTER && <RegisterForm onSwitchToLogin={() => navigate("/login")} />} {pageType === PAGE_TYPE_ENUM.REGISTER && <RegisterForm onSwitchToLogin={() => navigate("/login")} />}
{pageType === PAGE_TYPE_ENUM.FORGOT_PASSWORD && <ForgotPasswordForm />} {pageType === PAGE_TYPE_ENUM.FORGOT_PASSWORD && <ForgotPasswordForm />}

View File

@ -143,6 +143,21 @@ const TagProperties: React.FC<DroppedItemProps> = (
setDropDownToggle(null) setDropDownToggle(null)
} }
{/* Font */ }
const smeFonts = [
"Arial",
"Helvetica",
"Times New Roman",
"Georgia",
"Verdana",
"Tahoma",
"Trebuchet MS",
"Courier New",
"Lucida Console",
"Impact",
];
// useEffect(() => { // useEffect(() => {
// if (selectedTag.label == "temporal" && !("dateFormat" in selectedTag)) { // if (selectedTag.label == "temporal" && !("dateFormat" in selectedTag)) {
// handlePropertyChange("dateFormat", TEMPORAL.DATE); // handlePropertyChange("dateFormat", TEMPORAL.DATE);
@ -360,7 +375,11 @@ const TagProperties: React.FC<DroppedItemProps> = (
{ {
selectedTag.type.toLowerCase() == TagsTypes.TEMPORAL && selectedTag.type.toLowerCase() == TagsTypes.TEMPORAL &&
<CurrTimeStampAttr type={selectedTag.type} handlePropertyChange={handlePropertyChange} /> <CurrTimeStampAttr
type={selectedTag.type}
currentTimeStamp={selectedTag.currentTimeStamp ?? false}
handlePropertyChange={handlePropertyChange}
/>
} }
<LabelAttr label={selectedTag.label ?? ""} handlePropertyChange={handlePropertyChange} /> <LabelAttr label={selectedTag.label ?? ""} handlePropertyChange={handlePropertyChange} />
@ -451,66 +470,104 @@ const TagProperties: React.FC<DroppedItemProps> = (
className="block mb-2 font-medium">Styles</label> className="block mb-2 font-medium">Styles</label>
<IoIosArrowDown className={`${styleOpen ? "rotate-[-90deg]" : ""} transition-all`} /> <IoIosArrowDown className={`${styleOpen ? "rotate-[-90deg]" : ""} transition-all`} />
</div> </div>
{ {styleOpen && (
styleOpen && <> <div className="rounded-sm border border-slate-200 bg-white p-4 shadow-sm">
<div className="flex flex-wrap items-center gap-3">
{/* Font */} {/* Font */}
<div className="mb-2"> <div className="flex flex-col min-w-[140px] flex-1">
<label className="mr-2">Font</label> <label className="text-xs font-medium text-slate-500 mb-1">
<input Font
type="text" </label>
placeholder="e.g. Arial" <select
className="outline-none border-1 rounded px-2 py-1 border-slate-200" className="h-10 rounded-sm border border-slate-300 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
value={styles.font} value={styles.font}
onChange={(e) => handleStyleChange("font", e.target.value)} onChange={(e) => handleStyleChange("font", e.target.value)}
/> >
{smeFonts.map((font) => (
<option key={font} value={font}>
{font}
</option>
))}
</select>
</div> </div>
{/* Text Size */} {/* Font Size */}
<div className="mb-2"> <div className="flex flex-col w-24">
<label className="mr-2">Text Size</label> <label className="text-xs font-medium text-slate-500 mb-1">
<input Size
// value={} </label>
type="number" <select
className="outline-none border-1 rounded px-2 py-1 border-slate-200" className="h-10 rounded-sm border border-slate-300 px-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
value={styles.textSize} value={styles.textSize}
onChange={(e) => onChange={(e) =>
handleStyleChange("textSize", parseInt(e.target.value, 10) || 0) handleStyleChange("textSize", Number(e.target.value))
} }
/> >
{[7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 38, 72].map(
(size) => (
<option key={size} value={size}>
{size}
</option>
)
)}
</select>
</div> </div>
{/* Color */} {/* Color */}
<div className="mb-2"> <div className="flex flex-col">
<label className="mr-2">Color</label> <label className="text-xs font-medium text-slate-500 mb-1">
Color
</label>
<input <input
type="color" type="color"
className="outline-none border-1 rounded px-2 py-1 border-slate-200 w-10 h-8" className="h-10 w-14 cursor-pointer rounded-sm border border-slate-300 bg-white"
value={styles.color} value={styles.color}
onChange={(e) => handleStyleChange("color", e.target.value)} onChange={(e) =>
handleStyleChange("color", e.target.value)
}
/> />
</div> </div>
{/* Toggles for Bold, Italic, Underline */}
<div className="flex gap-4 items-center mt-2">
<label className="flex gap-1 items-center">
<input type="checkbox" checked={styles.bold}
onChange={(e) => handleStyleChange("bold", e.target.checked)} />
Bold
</label>
<label className="flex gap-1 items-center">
<input type="checkbox" checked={styles.italic} onChange={(e) => handleStyleChange("italic", e.target.checked)} />
Italic
</label>
<label className="flex gap-1 items-center">
<input type="checkbox" checked={styles.underline}
onChange={(e) =>
handleStyleChange("underline", e.target.checked)
} />
Underline
</label>
</div> </div>
</>
{/* Style Buttons */}
<div className="mt-4 flex flex-wrap gap-2">
<button
type="button"
onClick={() => handleStyleChange("bold", !styles.bold)}
className={`h-10 w-10 rounded-sm border transition ${styles.bold
? "bg-blue-600 text-white border-blue-600"
: "bg-white border-slate-300 hover:bg-slate-100"
}`}
>
<strong>B</strong>
</button>
<button
type="button"
onClick={() => handleStyleChange("italic", !styles.italic)}
className={`h-10 w-10 rounded-sm border transition ${styles.italic
? "bg-blue-600 text-white border-blue-600"
: "bg-white border-slate-300 hover:bg-slate-100"
}`}
>
<em>I</em>
</button>
<button
type="button"
onClick={() =>
handleStyleChange("underline", !styles.underline)
} }
className={`h-10 w-10 rounded-sm border transition ${styles.underline
? "bg-blue-600 text-white border-blue-600"
: "bg-white border-slate-300 hover:bg-slate-100"
}`}
>
<span className="underline">U</span>
</button>
</div>
</div>
)}
</div> </div>
} }

View File

@ -1,37 +1,42 @@
import React, { useState } from 'react'
interface CurrTimeStampAttrInt { interface CurrTimeStampAttrInt {
type: string; type: string;
handlePropertyChange: (changeTo: string, changeWith: string | boolean | number) => void; currentTimeStamp?: boolean;
handlePropertyChange: (
changeTo: string,
changeWith: string | boolean | number
) => void;
} }
const CurrTimeStampAttr: React.FC<CurrTimeStampAttrInt> = ({ type, handlePropertyChange}) => { const CurrTimeStampAttr: React.FC<CurrTimeStampAttrInt> = ({
type,
const [isCurrentTimeStamp, setIsCurrentTimeStamp] = useState<boolean>(true); currentTimeStamp = false,
handlePropertyChange,
}) => {
const handleIsCurrentTimeStamp = (checked: boolean) => { const handleIsCurrentTimeStamp = (checked: boolean) => {
if (type.toLowerCase() == "temporal") { if (type.toLowerCase() === "temporal") {
setIsCurrentTimeStamp(checked)
handlePropertyChange("currentTimeStamp", checked); handlePropertyChange("currentTimeStamp", checked);
} }
} };
return ( return (
<div className="flex justify-between items-center border-1 p-1.5 rounded-sm border-slate-200"> <div className="flex justify-between items-center border p-1.5 rounded-sm border-slate-200">
<label <label
className="text-slate-600 transitions-all duration-150 font-medium" className="text-slate-600 font-medium"
htmlFor="use_current_timestamp" htmlFor="use_current_timestamp"
> >
Use Current Timestamp Use Current Timestamp
</label> </label>
<input <input
checked={isCurrentTimeStamp ? isCurrentTimeStamp : false}
onChange={(e) => handleIsCurrentTimeStamp(e.target.checked)}
id="use_current_timestamp" id="use_current_timestamp"
type="checkbox" type="checkbox"
checked={currentTimeStamp}
onChange={(e) =>
handleIsCurrentTimeStamp(e.target.checked)
}
/> />
</div> </div>
) );
} };
export default CurrTimeStampAttr export default CurrTimeStampAttr;