Changed naming on share modal

This commit is contained in:
Lucas Oliveira 2023-12-09 20:22:06 -03:00
commit 66428b730e
2 changed files with 14 additions and 10 deletions

View file

@ -3,6 +3,7 @@ import { Input } from "../../components/ui/input";
import { Label } from "../../components/ui/label"; import { Label } from "../../components/ui/label";
import { Textarea } from "../../components/ui/textarea"; import { Textarea } from "../../components/ui/textarea";
import { InputProps } from "../../types/components"; import { InputProps } from "../../types/components";
import { cn } from "../../utils/utils";
export const EditFlowSettings: React.FC<InputProps> = ({ export const EditFlowSettings: React.FC<InputProps> = ({
name, name,
@ -32,7 +33,7 @@ export const EditFlowSettings: React.FC<InputProps> = ({
<> <>
<Label> <Label>
<div className="edit-flow-arrangement"> <div className="edit-flow-arrangement">
<span className="font-medium">Name</span>{" "} <span className="font-medium">Name{setName ? "" : ":"}</span>{" "}
{isMaxLength && ( {isMaxLength && (
<span className="edit-flow-span">Character limit reached</span> <span className="edit-flow-span">Character limit reached</span>
)} )}
@ -57,7 +58,7 @@ export const EditFlowSettings: React.FC<InputProps> = ({
<Label> <Label>
<div className="edit-flow-arrangement mt-3"> <div className="edit-flow-arrangement mt-3">
<span className="font-medium "> <span className="font-medium ">
Description {setDescription ? "(optional)" : ""} Description{setDescription ? " (optional)" : ":"}
</span> </span>
</div> </div>
{setDescription ? ( {setDescription ? (
@ -71,8 +72,13 @@ export const EditFlowSettings: React.FC<InputProps> = ({
rows={3} rows={3}
/> />
) : ( ) : (
<span className="font-normal text-muted-foreground word-break-break-word"> <span
{description} className={cn(
"font-normal text-muted-foreground word-break-break-word",
description === "" ? "font-light italic" : ""
)}
>
{description === "" ? "No description" : description}
</span> </span>
)} )}
</Label> </Label>

View file

@ -48,7 +48,7 @@ export default function ShareModal({
const [description, setDescription] = useState(component?.description ?? ""); const [description, setDescription] = useState(component?.description ?? "");
const [internalOpen, internalSetOpen] = useState(children ? false : true); const [internalOpen, internalSetOpen] = useState(children ? false : true);
const [openConfirmationModal, setOpenConfirmationModal] = useState(false); const [openConfirmationModal, setOpenConfirmationModal] = useState(false);
const nameComponent = is_component ? "Component" : "Flow"; const nameComponent = is_component ? "component" : "flow";
const [tags, setTags] = useState<{ id: string; name: string }[]>([]); const [tags, setTags] = useState<{ id: string; name: string }[]>([]);
const [loadingTags, setLoadingTags] = useState<boolean>(false); const [loadingTags, setLoadingTags] = useState<boolean>(false);
@ -121,9 +121,7 @@ export default function ShareModal({
}); });
function successShare() { function successShare() {
if (is_component) { if (!is_component) {
addFlow(true, flow, update);
} else {
saveFlow(flow!, true); saveFlow(flow!, true);
} }
setSuccessData({ setSuccessData({
@ -293,8 +291,8 @@ export default function ShareModal({
</> </>
) : ( ) : (
<> <>
{is_component && !loadingNames ? "Save and " : ""}Share{" "} Share{" "}
{!is_component && !loadingNames ? "Flow" : ""} {!loadingNames && (!is_component ? "Flow" : "Component")}
</> </>
)} )}
</Button> </Button>