Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): phone display issues #2386

Merged
merged 6 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const DeleteOrUnsubscribeConfirmationModal = ({
}
isOpen={isOpen}
setOpen={setOpen}
size="auto"
Trigger={<div />}
CloseTrigger={<div />}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
display: flex;
align-items: center;
gap: Spacings.$spacing03;
overflow: hidden;

.icon {
min-width: 16px;
}

.file_name {
@include Typography.EllipsisOverflow;
}
}

.options_modal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ const KnowledgeItem = ({
return (
<div className={styles.knowledge_item_wrapper}>
<div className={styles.left}>
<div className={styles.icon}>
{isUploadedKnowledge(knowledge) ? (
getFileIcon(knowledge.fileName)
) : (
<Icon name="link" size="normal" color="black" />
)}
</div>
{isUploadedKnowledge(knowledge) ? (
getFileIcon(knowledge.fileName)
) : (
<Icon name="link" size="normal" color="black" />
)}
{isUploadedKnowledge(knowledge) ? (
<span>{knowledge.fileName}</span>
<span className={styles.file_name}>{knowledge.fileName}</span>
) : (
<a href={knowledge.url} target="_blank" rel="noopener noreferrer">
{knowledge.url}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { useTranslation } from "react-i18next";

import Field from "@/lib/components/ui/Field";
import { Select } from "@/lib/components/ui/Select";
import { TextInput } from "@/lib/components/ui/TextInput/TextInput";
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";

import { RemoveAccessIcon } from "./components/RemoveAccessIcon";
Expand Down Expand Up @@ -35,7 +33,6 @@ export const BrainUser = ({
email,
});
const { currentBrain } = useBrainContext();
const { t } = useTranslation();

return (
<div
Expand All @@ -49,15 +46,7 @@ export const BrainUser = ({
/>
)}
<div className="flex flex-1">
<Field
name="email"
required
type="email"
placeholder={t("email")}
value={email}
data-testid="role-assignation-email-input"
readOnly
/>
<TextInput label="Email" inputValue={email} disabled={true} />
</div>
<Select
onChange={(newRole) => void updateSelectedRole(newRole)}
Expand Down
1 change: 1 addition & 0 deletions frontend/app/user/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const UserPage = (): JSX.Element => {
<Modal
isOpen={isLogoutModalOpened}
setOpen={setIsLogoutModalOpened}
size="auto"
CloseTrigger={<div />}
>
<div className="text-center flex flex-col items-center gap-5">
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/components/AddBrainModal/AddBrainModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const AddBrainModal = (): JSX.Element => {
desc={t("newBrainSubtitle", { ns: "brain" })}
isOpen={isBrainCreationModalOpened}
setOpen={setIsBrainCreationModalOpened}
bigModal={true}
size="big"
CloseTrigger={<div />}
>
<div className={styles.add_brain_modal_container}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const UploadDocumentModal = (): JSX.Element => {
setOpen={setShouldDisplayFeedCard}
title={t("addKnowledgeTitle", { ns: "knowledge" })}
desc={t("addKnowledgeSubtitle", { ns: "knowledge" })}
bigModal={true}
size="big"
CloseTrigger={<div />}
>
<div className={styles.knowledge_modal}>
Expand Down
8 changes: 6 additions & 2 deletions frontend/lib/components/ui/Modal/Modal.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
width: 35vw;
height: 80vh;

&.big_modal {
&.auto {
height: auto;
}

&.big {
width: 40vw;
height: 90vh;
}
Expand All @@ -38,7 +42,7 @@
}

@media (max-width: ScreenSizes.$small) {
width: 90vw;
min-width: 90vw;
}

.close_button_wrapper {
Expand Down
19 changes: 7 additions & 12 deletions frontend/lib/components/ui/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type CommonModalProps = {
CloseTrigger?: ReactNode;
isOpen?: undefined;
setOpen?: undefined;
bigModal?: boolean;
size?: "auto" | "normal" | "big";
unclosable?: boolean;
unforceWhite?: boolean;
};
Expand All @@ -38,8 +38,7 @@ const handleInteractOutside = (unclosable: boolean, event: Event) => {
};

const handleModalContentAnimation = (
isOpen: boolean,
bigModal: boolean,
size: "auto" | "normal" | "big",
unforceWhite: boolean
) => {
const initialAnimation = { opacity: 0, y: "-40%" };
Expand All @@ -50,9 +49,9 @@ const handleModalContentAnimation = (
initial: initialAnimation,
animate: animateAnimation,
exit: exitAnimation,
className: `${styles.modal_content_wrapper} ${
bigModal ? styles.big_modal : ""
} ${unforceWhite ? styles.white : ""}`,
className: `${styles.modal_content_wrapper} ${styles[size]} ${
unforceWhite ? styles.white : ""
}`,
};
};

Expand All @@ -64,7 +63,7 @@ export const Modal = ({
CloseTrigger,
isOpen: customIsOpen,
setOpen: customSetOpen,
bigModal,
size = "normal",
unclosable,
unforceWhite,
}: ModalProps): JSX.Element => {
Expand Down Expand Up @@ -97,11 +96,7 @@ export const Modal = ({
}
>
<motion.div
{...handleModalContentAnimation(
customIsOpen ?? isOpen,
!!bigModal,
!!unforceWhite
)}
{...handleModalContentAnimation(size, !!unforceWhite)}
>
<Dialog.Title
className="m-0 text-2xl font-bold"
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/components/ui/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type TextInputProps = {
iconName?: string;
label: string;
inputValue: string;
setInputValue: (value: string) => void;
setInputValue?: (value: string) => void;
simple?: boolean;
onSubmit?: () => void;
disabled?: boolean;
Expand Down Expand Up @@ -35,7 +35,7 @@ export const TextInput = ({
className={styles.text_input}
type={crypted ? "password" : "text"}
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
onChange={(e) => setInputValue?.(e.target.value)}
placeholder={label}
onKeyDown={(e) => {
if (e.key === "Enter" && onSubmit) {
Expand Down