Skip to content

Commit

Permalink
Staging (#72)
Browse files Browse the repository at this point in the history
* Feature/feedback (#66)

* Add information text due to backend issue

* feat: add mixpanel events (#64)

* remove debug

* feat: integrate ristek ads

* chore: bump version of ristek ads

* chore: revert config to use localhost

* chore: bump version of ristek ads to 1.2.6

* fix: disable mixpanel

* feat: create feedback modal

* feat: create feedback page

* feat: create google calendar popup

* feat: create admin login and feedback recap page

* fix: add todo comments for disabled analytics

* feat: integrate feedback feature with backend

---------

Co-authored-by: fajarriv <[email protected]>
Co-authored-by: fajarriv <[email protected]>
Co-authored-by: Valee <[email protected]>
Co-authored-by: Valerian Salim <[email protected]>
Co-authored-by: FreeJ1nG <[email protected]>
Co-authored-by: Andrew Jeremy <[email protected]>

* Feature/feedback (#69)

* Add information text due to backend issue

* feat: add mixpanel events (#64)

* remove debug

* feat: integrate ristek ads

* chore: bump version of ristek ads

* chore: revert config to use localhost

* chore: bump version of ristek ads to 1.2.6

* fix: disable mixpanel

* feat: create feedback modal

* feat: create feedback page

* feat: create google calendar popup

* feat: create admin login and feedback recap page

* fix: add todo comments for disabled analytics

* feat: integrate feedback feature with backend

* fix: fix social media icon bug in footer

* fix: replace ristek logo from old to new

* fix: fix routing and design issues

---------

Co-authored-by: fajarriv <[email protected]>
Co-authored-by: fajarriv <[email protected]>
Co-authored-by: Valee <[email protected]>
Co-authored-by: Valerian Salim <[email protected]>
Co-authored-by: FreeJ1nG <[email protected]>
Co-authored-by: Andrew Jeremy <[email protected]>

* fix: solve merge conflicts

* feat: integrate admin login and feedback recap page with backend

* feat: add google calendar popup to daftar jadwal page

* refactor: remove unused feedback dummy data

* Integrate admin login and feedback recap page with backend (#71)

* fix: solve merge conflicts

* feat: integrate admin login and feedback recap page with backend

* feat: add google calendar popup to daftar jadwal page

* refactor: remove unused feedback dummy data

* hotfix: add token validation

* HOTFIX: Add token validation (#73)

* fix: solve merge conflicts

* feat: integrate admin login and feedback recap page with backend

* feat: add google calendar popup to daftar jadwal page

* refactor: remove unused feedback dummy data

* hotfix: add token validation

* fix: re-enable mixpanel

---------

Co-authored-by: Reyhan Zada Virgiwibowo <[email protected]>
Co-authored-by: fajarriv <[email protected]>
Co-authored-by: fajarriv <[email protected]>
Co-authored-by: Valee <[email protected]>
Co-authored-by: Valerian Salim <[email protected]>
Co-authored-by: Veivel Pattiwael <[email protected]>
  • Loading branch information
7 people authored Aug 7, 2024
1 parent 9643fdd commit a522fb5
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 81 deletions.
3 changes: 1 addition & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const config = {
MIXPANEL_PROJECT_TOKEN: process.env.REACT_APP_MIXPANEL_PROJECT_TOKEN,
},
production: {
// API_BASE_URL: process.env.REACT_APP_AWS_BACKEND_URL,
API_BASE_URL: "https://stg.api.susunjadwal.cs.ui.ac.id/susunjadwal/api",
API_BASE_URL: process.env.REACT_APP_AWS_BACKEND_URL,
BASE_URL: "/",
},
development: {
Expand Down
5 changes: 2 additions & 3 deletions src/containers/BuildSchedule/CourseClass.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import styled from "styled-components";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import { useSelector, useDispatch } from "react-redux";
import { addSchedule, removeSchedule } from "redux/modules/schedules";
import { useColorModeValue } from "@chakra-ui/react";
Expand Down Expand Up @@ -100,8 +100,7 @@ function CourseClass({ course, courseClass }) {
dispatch(removeSchedule(item));
} else {
dispatch(addSchedule(item));
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("select_course");
useMixpanel.track("select_course");
}
};

Expand Down
8 changes: 3 additions & 5 deletions src/containers/BuildSchedule/SelectMajor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import { Flex } from "@chakra-ui/react";
import FACULTIES from "utils/faculty-base-additional-info.json";
import { useForm } from "react-hook-form";
Expand Down Expand Up @@ -29,13 +29,11 @@ function SelectMajor({ theme, isMobile, setMajorSelected, show }) {
}

useEffect(() => {
// TODO: Re-enable mixpanel or change to other analytics
// if (selectedFaculty) useMixpanel.track("select_faculty");
if (selectedFaculty) useMixpanel.track("select_faculty");
}, [selectedFaculty]);

useEffect(() => {
// TODO: Re-enable mixpanel or change to other analytics
// if (selectedMajorName) useMixpanel.track("select_prodi");/
if (selectedMajorName) useMixpanel.track("select_prodi");
}, [selectedMajorName]);

return (
Expand Down
12 changes: 5 additions & 7 deletions src/containers/BuildSchedule/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState, useCallback, useRef } from "react";
import { useSelector, useDispatch } from "react-redux";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import {
Button,
useColorModeValue,
Expand Down Expand Up @@ -97,15 +97,13 @@ function BuildSchedule() {
}
});

// TODO: Re-enable mixpanel or change to other analytics
// useEffect(() => {
// useMixpanel.track("open_buat_jadwal");
// }, []);
useEffect(() => {
useMixpanel.track("open_buat_jadwal");
}, []);

useEffect(() => {
if (isInitialMount.current) isInitialMount.current = false;
// TODO: Re-enable mixpanel or change to other analytics
// else useMixpanel.track("search_course");
else useMixpanel.track("search_course");
}, [value]);

return (
Expand Down
11 changes: 4 additions & 7 deletions src/containers/Contributors/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useState } from "react";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import { Text, Box, Button, Flex, useColorModeValue } from "@chakra-ui/react";
import { ChevronLeftIcon } from "@chakra-ui/icons";
import { Link } from "react-router-dom";
Expand Down Expand Up @@ -36,8 +36,7 @@ const Contributors = () => {
}, [fetchContributors]);

useEffect(() => {
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("open_contributors");
useMixpanel.track("open_contributors");
}, []);

const MergeContributors = (contributors, otherContributors) => {
Expand Down Expand Up @@ -91,8 +90,7 @@ const Contributors = () => {
avatar={user.avatar_url}
github={user.html_url}
contributions={user.contributions}
// TODO: Re-enable mixpanel or change to other analytics
// onClick={() => useMixpanel.track("see_contributor_detail")}
onClick={() => useMixpanel.track("see_contributor_detail")}
/>
));

Expand Down Expand Up @@ -139,8 +137,7 @@ const Contributors = () => {
<a
href="https://ristek.link/oss-discord"
rel="noopener noreferrer"
// TODO: Re-enable mixpanel or change to other analytics
// onClick={() => useMixpanel.track("gabung_discord")}
onClick={() => useMixpanel.track("gabung_discord")}
target="_blank"
>
<Button
Expand Down
7 changes: 3 additions & 4 deletions src/containers/Header/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Link, useLocation } from "react-router-dom";
import { useSelector } from "react-redux";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import React from "react";

import {
Expand Down Expand Up @@ -93,9 +93,8 @@ function Header() {
type="checkbox"
onClick={() => {
toggleColorMode();
// TODO: Re-enable mixpanel or change to other analytics
// if (theme === "light") useMixpanel.track("dark_mode");
// else useMixpanel.track("light_mode");
if (theme === "light") useMixpanel.track("dark_mode");
else useMixpanel.track("light_mode");
}}
checked={theme === "light" ? false : true}
/>
Expand Down
8 changes: 3 additions & 5 deletions src/containers/Login/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useSelector, useDispatch } from "react-redux";
import { Fade, Button, Box, useColorModeValue } from "@chakra-ui/react";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import React, { useEffect, useState, useMemo, useRef } from "react";
import { Link } from "react-router-dom";
import { parse } from "query-string";
Expand Down Expand Up @@ -399,8 +399,7 @@ function Login({ history, location }) {
href="https://ristek.link/oss-discord"
rel="noopener noreferrer"
target="_blank"
// TODO: Re-enable mixpanel or change to other analytics
// onClick={() => useMixpanel.track("gabung_discord")}
onClick={() => useMixpanel.track("gabung_discord")}
>
<DiscordButton _hover={{ background: "primary.Purple" }}>
Join Discord
Expand All @@ -409,8 +408,7 @@ function Login({ history, location }) {
<div style={{ minWidth: "16px", minHeight: "16px" }}></div>
<Link
to="/kontributor"
// TODO: Re-enable mixpanel or change to other analytics
// onClick={() => useMixpanel.track("see_contributor_detail")}
onClick={() => useMixpanel.track("see_contributor_detail")}
>
<DiscordButton variant="outline">Lihat Kontributor</DiscordButton>
</Link>
Expand Down
6 changes: 2 additions & 4 deletions src/containers/ScheduleList/ScheduleDetail.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useRef } from "react";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import { Link } from "react-router-dom";
import { useSelector } from "react-redux";
import styled from "styled-components";
Expand Down Expand Up @@ -67,9 +67,7 @@ const ScheduleDetail = ({
return (
<>
<Link
// TODO: Re-enable mixpanel or change to other analytics
// onClick={() => useMixpanel.track("open_jadwal")}
onClick={null}
onClick={() => useMixpanel.track("open_jadwal")}
to={`/jadwal/${schedule.id}`}
>
<Card key={`${schedule.name}-${idx}`} mode={theme}>
Expand Down
11 changes: 4 additions & 7 deletions src/containers/ScheduleList/SortByTermButton.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import { useSelector } from "react-redux";
import {
Menu,
Expand Down Expand Up @@ -50,8 +50,7 @@ const SortByTermButton = ({ isSortByLatest, setSortByLatest }) => {
display="flex"
justifyContent="center"
alignItems="center"
// TODO: Re-enable mixpanel or change to other analytics
// onClick={() => useMixpanel.track("sort_daftar_jadwal")}
onClick={() => useMixpanel.track("sort_daftar_jadwal")}
/>
<MenuList>
<MenuOptionGroup
Expand All @@ -62,8 +61,7 @@ const SortByTermButton = ({ isSortByLatest, setSortByLatest }) => {
<MenuItemOption
onClick={() => {
setSortByLatest(true);
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("sort_semester_terbaru");
useMixpanel.track("sort_semester_terbaru");
}}
value="desc"
>
Expand All @@ -72,8 +70,7 @@ const SortByTermButton = ({ isSortByLatest, setSortByLatest }) => {
<MenuItemOption
onClick={() => {
setSortByLatest(false);
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("sort_semester_terlama");
useMixpanel.track("sort_semester_terlama");
}}
value="asc"
>
Expand Down
11 changes: 4 additions & 7 deletions src/containers/ScheduleList/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState, useRef } from "react";
import ReactGA from "react-ga";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import { useHistory } from "react-router";
import {
Button,
Expand Down Expand Up @@ -118,14 +118,12 @@ const ScheduleList = () => {
}, [filteredSchedules, isSortByLatest]);

useEffect(() => {
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("open_daftar_jadwal");
useMixpanel.track("open_daftar_jadwal");
}, []);

useEffect(() => {
if (isInitialMount.current) isInitialMount.current = false;
// TODO: Re-enable mixpanel or change to other analytics
// else useMixpanel.track("search_daftar_jadwal");
else useMixpanel.track("search_daftar_jadwal");
}, [query]);

const performDeleteSchedule = async (userId, scheduleId) => {
Expand Down Expand Up @@ -325,8 +323,7 @@ const ScheduleList = () => {
}
onMouseDown={() => {
setQuery(document.getElementById("input").value);
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("search_daftar_jadwal");
useMixpanel.track("search_daftar_jadwal");
}}
fontSize={isMobile && "14px"}
px={isMobile && "4px"}
Expand Down
11 changes: 4 additions & 7 deletions src/containers/SelectedCourses/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import ReactGA from "react-ga";
import styled from "styled-components";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import { withRouter } from "react-router";

import { useSelector, useDispatch } from "react-redux";
Expand Down Expand Up @@ -161,8 +161,7 @@ function SelectedCourses({ history, scheduleId, isEditing }) {
<Button
onClick={() => {
onClose();
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("cancel");
useMixpanel.track("cancel");
}}
variant="outline"
borderColor={
Expand All @@ -180,8 +179,7 @@ function SelectedCourses({ history, scheduleId, isEditing }) {
? handleDeleteSchedule()
: updateSchedule();

// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("simpan_jadwal");
useMixpanel.track("simpan_jadwal");
}}
variant="solid"
bg={theme === "light" ? "primary.Purple" : "dark.LightPurple"}
Expand Down Expand Up @@ -245,8 +243,7 @@ function SelectedCourses({ history, scheduleId, isEditing }) {

<Button
onClick={() => {
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("open_simpan_modal");
useMixpanel.track("open_simpan_modal");
onOpen();
}}
disabled={isConflict || totalCredits > 24 || schedules.length === 0}
Expand Down
14 changes: 5 additions & 9 deletions src/containers/UpdateCourses/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect } from "react";
import ReactGA from "react-ga";
import Helmet from "react-helmet";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
import styled from "styled-components";
import { useForm } from "react-hook-form";
import { useSelector } from "react-redux";
Expand Down Expand Up @@ -42,22 +42,19 @@ const UpdateCourses = () => {
const password = watch("password");

useEffect(() => {
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("open_update_matkul");
useMixpanel.track("open_update_matkul");
}, []);

useEffect(() => {
if (username && !isUsernameChanged) {
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("update_matkul_fill_username");
useMixpanel.track("update_matkul_fill_username");
setIsUsernameChanged(true);
}
}, [username, isUsernameChanged]);

useEffect(() => {
if (password && !isPasswordChanged) {
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("update_matkul_fill_password");
useMixpanel.track("update_matkul_fill_password");
setIsPasswordChanged(true);
}
}, [password, isPasswordChanged]);
Expand Down Expand Up @@ -136,8 +133,7 @@ const UpdateCourses = () => {
w={{ sm: "100%", lg: "unset" }}
bg={theme === "light" ? "primary.Purple" : "dark.LightPurple"}
color={theme === "light" ? "white" : "dark.White"}
// TODO: Re-enable mixpanel or change to other analytics
// onClick={() => useMixpanel.track("update_matkul")}
onClick={() => useMixpanel.track("update_matkul")}
>
Update Jadwal
</Button>
Expand Down
8 changes: 3 additions & 5 deletions src/containers/ViewSchedule/Schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useSelector } from "react-redux";
import { useColorModeValue } from "@chakra-ui/react";
import { useDisclosure } from "@chakra-ui/react";
import DetailsModal from "./DetailsModal";
// import { useMixpanel } from "hooks/useMixpanel";
import { useMixpanel } from "hooks/useMixpanel";
const DAYS = ["Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"];

const pad = (val) => {
Expand Down Expand Up @@ -63,15 +63,13 @@ function Schedule({
);

const handleClickedCourse = (course) => {
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("open_course_detail");
useMixpanel.track("open_course_detail");
setSelectedCourse(course);
onOpen();
};

const handleCloseModal = () => {
// TODO: Re-enable mixpanel or change to other analytics
// useMixpanel.track("close_course_detail");
useMixpanel.track("close_course_detail");
onClose();
};

Expand Down
2 changes: 2 additions & 0 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Contributors from "containers/Contributors";
import Feedback from "containers/Feedback";
import AdminLogin from "containers/Admin/Login";
import AdminFeedbacks from "containers/Admin/Feedbacks";
import { validateAuth } from "utils/auth";

import withAnalytics from "utils/analytics";

Expand Down Expand Up @@ -105,6 +106,7 @@ function RoutesWithNavbar() {
}

function PrivateRoute({ component: Component, ...rest }) {
validateAuth();
const auth = useSelector((state) => state.auth);

return (
Expand Down
3 changes: 3 additions & 0 deletions src/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,6 @@ export const updateReviewStatus = async (token, reviewId, status) =>
headers: { Authorization: `Bearer ${token}` },
},
);

export const validateToken = async () =>
await instance.get("/auth/me");
Loading

0 comments on commit a522fb5

Please sign in to comment.