Skip to content

Commit

Permalink
removed dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeNonis committed Sep 29, 2023
1 parent 2464dfe commit fc6ba77
Show file tree
Hide file tree
Showing 42 changed files with 13 additions and 154 deletions.
20 changes: 1 addition & 19 deletions backend/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,9 @@ export const findNoteIndex = (arr, id) => {
export const createUser = (email, hashedPwd, image) => {
const curr = new Date();
curr.setDate(curr.getDate());
// console.log({ curr });
const date = curr.toISOString().substring(0, 10);
// console.log({ date });
const lastTimeDitedNote = curr.toISOString().substring(0, 10);
// console.log({ lastTimeDitedNote });
// console.log("okay until here");

const user = {
userId: uuidv4(),
email,
Expand All @@ -140,18 +137,3 @@ export const createUser = (email, hashedPwd, image) => {
};
return user;
};

// export const convertImageToBase64 = (imgUrl, callback) => {
// const image = new Image();
// image.crossOrigin = "anonymous";
// image.onload = () => {
// const canvas = document.createElement("canvas");
// const ctx = canvas.getContext("2d");
// canvas.height = image.naturalHeight;
// canvas.width = image.naturalWidth;
// ctx.drawImage(image, 0, 0);
// const dataUrl = canvas.toDataURL();
// callback && callback(dataUrl);
// };
// image.src = imgUrl;
// };
1 change: 0 additions & 1 deletion frontend/__tests__/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const initiateUser = async () => {
};

const getUser = async () => {
// const response = await axios.post(`http://localhost:4569/v1/signup`, { email: 'nonis@gmail.com', pwd: '123' })
const email = "nonis@gmail.com";
const pwd = "123";
const response = await fetch(`http://localhost:4569/v1/signup`, {
Expand Down
6 changes: 0 additions & 6 deletions frontend/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
// export default {
// transform: {
// "^.+\\.tsx?$": "ts-jest",
// },
// };

export default {
testEnvironment: "jsdom",
transform: {
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import Error from "./errors";
// import RootLayout from "./pages/rootLayout";
import { lazy, Suspense } from "react";
import ArchiveNotesSection from "./components/sections/archive-notes-section";
import { Loading, LoadingSpinner } from "./components";
import { LoadingSpinner } from "./components";

const RootLayout = lazy(() => import("./pages/rootLayout"));
const ExistinNotesSection = lazy(
Expand Down
10 changes: 0 additions & 10 deletions frontend/src/components/form-components/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
// export interface FormProps {
// display: boolean;
// onChangeNote: (e: React.ChangeEvent<HTMLInputElement>) => void;
// onChangeTitle: (e: React.ChangeEvent<HTMLInputElement>) => void;
// note: string;
// setDisplay: (arg: boolean) => void;
// title: string;
// }

import { InitialState } from "../../store/interfaces";
import { useExistingNotesSection } from "../sections/existing-notes-section/useExistingNotesSection";

export interface InputTextProps
extends React.InputHTMLAttributes<HTMLInputElement> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const MenuThreeLines = () => {
<div className={styles.menuThreeLines}>
<AiOutlineMenu className={styles.burger} onClick={toggleMenuThreeLines} />
<img
// src="../../../images/googlekeeplogo.png"
src="./googlekeeplogo.png"
alt="notes_logo"
className={styles.logo}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface AccountAvatarProps {
const AccountAvatar = ({ initialState }: AccountAvatarProps) => {
const { values, handlers } = useAccountAvatar(initialState);
const { image } = initialState;
// console.log(values.hoverOnAvatar);

return (
<>
<Transition
Expand All @@ -34,14 +34,7 @@ const AccountAvatar = ({ initialState }: AccountAvatarProps) => {
)
}
</Transition>
{/* {values.changeAvatar &&
ReactDOM.createPortal(
<AvatarOptions
closeModal={handlers.setChangeAvatar}
avatarHandler={handlers.selectAvatarHandler}
/>,
document.getElementById("avataroptions")!
)} */}

<div className={styles.mainContent}>
<div className={styles.avatars}>
<img
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export const useAccountAvatar = (initialState: InitialState) => {
}, 250);
}, 500);
} else {
// console.log(response[1]?.message);
}
dispatch(fetchingDataHandler());
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useState } from "react";
import styles from "./styles.module.scss";
import { InitialState } from "../../../../store/interfaces";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export interface useAccountSettingsProps {}

export interface AccountSettingsProps {
transitionState: string;
// closeModal: Dispatch<SetStateAction<boolean>>;
}

export interface NavLinkProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export const useEditLabelsModal = (
const response = await addLabelHttp({ label, labelId: sharedId, token });
const sucessfullRequest = isThereError(response);
sucessfullRequest && dispatch(addLabel({ label, labelId: sharedId }));
// : dispatch(errorState(response[1]?.message));

setLabel("");
dispatch(fetchingDataHandler());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const useLabel = (label: string) => {
params.labelId?.split(":")[1] && navigate("/notes");
dispatch(deleteLabel(label));
} else {
// dispatch(errorState(response[1]?.message));
}
dispatch(fetchingDataHandler());
};
Expand All @@ -50,7 +49,6 @@ export const useLabel = (label: string) => {
if (sucessfullRequest) {
dispatch(editLabel({ label, newLabel }));
} else {
// dispatch(errorState(response[1]?.message));
}
dispatch(fetchingDataHandler());
};
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/components/modals/editLabelsModal/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ export interface LabelProps {
values: {
labels: Labels[];
};
actions: {
// dispatch: ReduxDispatch<AnyAction>;
// removeLabelHandler: (label: string) => void;
};
actions: {};
};
}
3 changes: 1 addition & 2 deletions frontend/src/components/notes/deleted-note/useDeletedNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const useDeletedNote = ({ note, zindex }: Props) => {

const sucessfullRequest = isThereError(response);
sucessfullRequest && dispatch(restoreNote(note.id));
// : dispatch(errorState(response[1]?.message));

dispatch(fetchingDataHandler());
};

Expand All @@ -36,7 +36,6 @@ export const useDeletedNote = ({ note, zindex }: Props) => {

const sucessfullRequest = isThereError(response);
sucessfullRequest && dispatch(removeNote(note.id));
// : dispatch(errorState(response[1]?.message));

setReview(false);
dispatch(fetchingDataHandler());
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/components/notes/existing-note/useNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const useNote = ({ note, pinned, zindex }: CustomHook) => {
editNote({ pinned, id: noteId, titleValue: noteTitle, noteValue })
);
dispatch(fetchingDataHandler());
// : dispatch(errorState(response[1]?.message));
};

const pinNoteHandler = async (e: React.MouseEvent) => {
Expand All @@ -45,10 +44,8 @@ export const useNote = ({ note, pinned, zindex }: CustomHook) => {

const sucessfullRequest = isThereError(response);
sucessfullRequest && dispatch(pinHandler(note.id));
// : dispatch(errorState(response[1]?.message));
dispatch(fetchingDataHandler());
};
// const zIndex = !review ? zindex : 20002;
const zIndex = !review ? "auto" : 20002;
const disableBtn = noteValue === note.note && noteTitle === note.title;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export interface AddLabelProps {
id: string;
pinned: boolean;
archived?: boolean;
// styles: CSSModuleClasses;
}

export interface Note {
Expand All @@ -29,6 +28,5 @@ export interface CheckBoxProps {
id: string
) => void;
addLabelHandler: () => void;
// checkBoxStyle: (obj: Labels) => string;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const useAddLabel = ({ id, pinned, archived }: AddLabelProps) => {
dispatch(
addLabel({ id, pinned, archived, label: value, labelId: sharedId })
);
// : dispatch(errorState(response[1]?.message));

setValue("");
dispatch(fetchingDataHandler());
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const useBackgroundimage = ({
);
const sucessfullRequest = isThereError(response);
sucessfullRequest && dispatch(setColor({ value, id, pinned, archived }));
// : dispatch(errorState(response[1]?.message));

setDisplayPalette(false);
dispatch(fetchingDataHandler());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { useDispatch } from "react-redux";
import { updateNoteColorHttp } from "../../../../../services";
import { errorState } from "../../../../../store/display-state-slice";
import { setColor } from "../../../../../store/notes-slice";
import { isThereError } from "../../../../../utils/utils";
import { ColorPalleteProps } from "./interfaces";
import { colorGenerator } from "./utils";

Expand All @@ -15,12 +11,6 @@ export const useColorPallete = ({
const token = sessionStorage.getItem("auth-token")!;

const displayHandler = async (value: string) => {
// const response = await updateNoteColorHttp(value, id, pinned, token);

// const sucessfullRequest = isThereError(response);
// sucessfullRequest && dispatch(setColor({ value, id, pinned }));
// : dispatch(errorState(response[1]?.message));

setDisplayPalette(false);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export const useOptions = ({
if (sucessfullRequest) {
dispatch(copyNote({ id, pinned, archived, sharedId }));
} else {
// dispatch(errorState(response[1]?.message));
}

dispatch(httpReqResLoading());
Expand All @@ -76,7 +75,7 @@ export const useOptions = ({

sucessfullRequest &&
dispatch(deleteNote({ id: note.id, pinned, archived }));
// : dispatch(errorState(response[1]?.message));

setDisplay(false);
dispatch(fetchingDataHandler());
};
Expand Down Expand Up @@ -116,7 +115,6 @@ export const useOptions = ({
if (sucessfullRequest) {
dispatch(checkBoxes({ id: note.id, pinned, archived }));
} else {
// dispatch(errorState(response[1]?.message));
}
setDiscardBoxes(!discardBoxes);
} else {
Expand All @@ -136,7 +134,6 @@ export const useOptions = ({
dispatch(
checkBoxes({ id: note.id, pinned, archived, uncheckednote })
);
// : dispatch(errorState(response[1]?.message));
}
}
dispatch(fetchingDataHandler());
Expand All @@ -156,7 +153,6 @@ export const useOptions = ({
sucessfullRequest && !archived
? dispatch(archiveNote({ id: note.id, pinned }))
: dispatch(unarchiveNote({ id: note.id }));
// : dispatch(errorState(response[1]?.message));
dispatch(fetchingDataHandler());
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const useCheckBox = ({
if (sucessfullRequest) {
dispatch(checkBox({ id: noteId, boxid, checked, pinned, archived }));
} else {
// dispatch(errorState(response[1]?.message));
}
setLoading(false);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import styles from "../../note.module.scss";

const DeletedNoteWrapper = ({
children,
// clickOutsideNote,
zIndex,
review,
note,
setReview,
}: DeletedNoteWrapperProps) => {
return (
<div
// ref={clickOutsideNote}
style={{
zIndex: zIndex,
backgroundColor: colorLogic({ review, note }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ const ArchiveNotesSection = () => {

if (useStore.values.loading) return <Comp.LoadingSpinner />;

// if (useStore.values.error === "Network Error") return <></>;

const notes = !useStore.values.loading && archivedNotes.length !== 0 && (
<Comp.ArchivedNotesSection notes={[...archivedNotes]} />
);

return (
<Wrapper styles={styles}>
<section className={styles.allNotes}>
{/* <NoArchievedNotesMsg /> */}
{archivedNotes.length > 0 ? notes : <Comp.NoArchievedNotesMsg />}
</section>
</Wrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const useArchivedNote = ({ note, zindex }: CustomHook) => {
dispatch(fetchingDataHandler());
};

// const zIndex = !review ? zindex : 20002;
const zIndex = !review ? "auto" : 20002;
const disableBtn = noteValue === note.note && noteTitle === note.title;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const useArchiveNotesSection = () => {
);
const { error, loadingInitialState } = displayState;
const [display, setDisplay] = useState<boolean>(false);
// const dispatch = useDispatch();

const clickOutsideNote = useOutsideClick(() => {
setDisplay(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ const ExistinNotesSection = () => {
} = useSelector((state: IRootState) => state);
if (useStore.values.loading) return <LoadingSpinner />;

// if (useStore.values.error === "Network Error") return <></>;

const pinnedNotes = useStore.values.state.pinnedNotes.length !== 0 && (
<PinnedNotesSection notes={[...useStore.values.state.pinnedNotes!]} />
);
const notes = useStore.values.state.notes.length !== 0 && (
// <NotesSection notes={[...useStore.values.state.notes]} />
<NotesSection notes={[...existingnotes]} />
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useSelector } from "react-redux";
import { IRootState } from "../../../../store/store";

const NotesSection = ({
// notes,
dragable = true,
}: {
notes: NoteObj[];
Expand All @@ -15,7 +14,7 @@ const NotesSection = ({
const { onDragEnter, onDragStart, onDragEnd } = useNotesSection();
const { notes } = useSelector((state: IRootState) => state.notes);
let zIndex = 1000;
// console.log({ notes });

return (
<main className={styles.content}>
<div className={styles.notes}>
Expand Down
Loading

0 comments on commit fc6ba77

Please sign in to comment.