Skip to content

Commit

Permalink
fix(client): removed myinfoid, fixed delete (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
neilscallywag authored Apr 1, 2024
1 parent f905333 commit 6c2cbf6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ VITE_API_BASE_URL=http://localhost:8000

VITE_URL_ENVIRONMENT_PREFIX=test
VITE_MYINFO_CLIENT_ID=STG2-MYINFO-SELF-TEST
VITE_MYINFO_REDIRECT_URL=http://localhost:3001/callback
VITE_MYINFO_REDIRECT_URL=https://localhost:3001/callback
VITE_MYINFO_SCOPE="uinfin name email"
VITE_MYINFO_PURPOSE_ID=demonstration
VITE_MYINFO_AUTH_API_URL=https://test.api.myinfo.gov.sg/com/v4/authorize
Expand Down
9 changes: 4 additions & 5 deletions client/src/pages/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@ import {
Center,
Flex,
Heading,
IconButton,
Image,
Stack,
Text,
} from "@chakra-ui/react";

import MyInfoLogo from "~assets/img/singpass/Primary@2x.png";
// import MyInfoLogo from "~assets/img/singpass/Primary@2x.png";
import SgIDLogo from "~assets/img/singpass/sgid_logo.png";
import SingPassLogo from "~assets/img/singpass/singpass_logo_fullcolours-1.png";

import { useAuth } from "~features/auth";

const LoginPage = () => {
const { sgIdGetAuthUrl, myInfoGetCode, googleAuth } = useAuth();
const { sgIdGetAuthUrl, googleAuth } = useAuth();

return (
<Flex minH="100vh" align="center" justify="center" bg={"darkBlue.500"}>
Expand Down Expand Up @@ -65,14 +64,14 @@ const LoginPage = () => {
rightIcon={<Image src={SgIDLogo} boxSize="60px" height="30px" />}
onClick={sgIdGetAuthUrl}
/>
<IconButton
{/* <IconButton
aria-label="myinfo"
border="none"
size="lg"
icon={<Image src={MyInfoLogo} boxSize="100%" objectFit="cover" />}
onClick={myInfoGetCode}
w={{ base: "full", sm: "80%" }}
/>
/> */}
</Stack>
</Box>
</Stack>
Expand Down
1 change: 1 addition & 0 deletions client/src/pages/notes/NotesGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const NotesGeneratorPage = () => {
handleGenerationChange={handleGenerationChange}
handleGenerate={handleGenerate}
setGenerateType={setGenerateType}
handleDelete={() => setSelectedFile(undefined)}
/>
<Modal isOpen={isModalOpen} onClose={closeModal}>
<ModalOverlay />
Expand Down
11 changes: 11 additions & 0 deletions client/src/pages/notes/components/NotesUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface NotesUploadProps {
handleGenerate: () => void;
handleChange: (file: File) => void;
handleGenerationChange: () => void;
handleDelete: () => void;
}

const NotesUpload = ({
Expand All @@ -20,6 +21,7 @@ const NotesUpload = ({
handleGenerationChange,
handleGenerate,
setGenerateType,
handleDelete,
}: NotesUploadProps) => {
const DropZoneAccept = [".pdf"];
const maxSize = 5 * 1024 * 1024; // 16MB in bytes
Expand Down Expand Up @@ -53,9 +55,17 @@ const NotesUpload = ({
} else if (fileOrFiles) {
// It's a single File object
handleChange(fileOrFiles);
} else {
// No file is provided, handle accordingly
handleDelete();
}

};

// const onDelete = () => {
// handleDelete(); // Call the provided handleDelete method to remove the selected file
// };

const generateFlashcard = generateType === "flashcard";

return (
Expand All @@ -80,6 +90,7 @@ const NotesUpload = ({
onError={handleError}
onFileValidation={handleFileValidation}
required

/>
</Box>
<Box width="100%" textAlign="center">
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/viewnotes/ViewNotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function ViewNotes() {
<IconButton
aria-label="Go back"
icon={<ArrowBackIcon />}
onClick={() => navigate(-1)}
onClick={() => navigate("/marketplace")}
style={{ marginBottom: 30 }}
variant="ghost"
color="white"
Expand Down

0 comments on commit 6c2cbf6

Please sign in to comment.