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

feat: Auth Logic, Call pagination and filtering, unit and e2e tests, websocket, ci/cd #36

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

geryit
Copy link

@geryit geryit commented Jun 14, 2024

Description

This pull request introduces a range of critical enhancements and bug fixes to the calls list view , authentication features, and style changes. The primary updates include:

Junior Software Engineer Contributions:

  1. Pagination Improvement: Fixed the pagination dropdown to correctly update the number of calls displayed per page.

  2. Filtering Feature: Added filtering functionality in the calls list view, allowing users to filter by call type or direction.

  3. Grouping Calls by Date: Implemented a feature to group calls made on the same day into one section for better readability.

Google.Chrome.-.React.App.2024-06-14.at.8.00.31.PM.mp4

Software Engineer Contributions

  1. Logout Feature Fix: Corrected the logout functionality to prevent automatic redirection back to the calls list after logging out. Forwarding user to /login if the session has expired.
Google.Chrome.-.React.App.2024-06-14.at.7.14.31.PM.mp4
  1. Token Expiration UX Improvement: Enhanced user experience by redirecting users to the login page with an information toast when access tokens expire.
Google.Chrome.-.React.App.2024-06-14.at.7.40.55.PM.mp4
  1. Unit Tests: Added unit tests for the date helper functions to ensure accuracy and reliability.

Screenshot by Dropbox Capture

Senior Software Engineer Contributions

  1. End-to-End Testing: Implemented an end-to-end test to ensure users can log into the app, access call details, and log out without issues.

Screenshot by Dropbox Capture

Google.Chrome.-.Default.Project.2024-06-14.at.7.27.05.PM.mp4
  1. Archive Call Feature with Real-time Support: Added the ability to archive calls with real-time updates. Changes made in one tab are now reflected in another open tab. Submitted a PR for review and integration into production.
Google.Chrome.-.React.App.2024-06-14.at.7.33.42.PM.mp4

Staff Engineer and Above Contributions

  1. Production Release Plan: Developed a comprehensive plan for releasing the app into production. Focused on testing, CI/CD, documentation, performance, scaling, and developer experience to ensure a smooth and efficient release process.
    Added a Github workflow that runs the tests and deploys to Vercel: deploy

Live demo: https://phone-test-ruddy.vercel.app

Goksel Eryigit added 8 commits June 14, 2024 16:53
…ency path for phone-test, ensuring correct dependencies are installed.
…ency path for phone-test, ensuring correct dependencies are installed.
…ency path for phone-test, ensuring correct dependencies are installed.
…ency path for phone-test, ensuring correct dependencies are installed.
@geryit geryit changed the title New feature Feat: Auth Logic, Call pagination and filtering, unit and e2e tests, websocket, ci/cd Jun 14, 2024
@geryit geryit changed the title Feat: Auth Logic, Call pagination and filtering, unit and e2e tests, websocket, ci/cd feat: Auth Logic, Call pagination and filtering, unit and e2e tests, websocket, ci/cd Jun 14, 2024
env:
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# in GitHub repo → Settings → Secrets → Actions
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add CYPRESS_RECORD_KEY to Github Action secrets to make this work. Once secret is added, we can get detailed reports on https://cypress.io

Comment on lines +3 to +4
on:
push:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For demo purposes, deployment runs on every push. We replace with

on:
  push:
    branches:
    - master

before production

…tests, removed ".idea" from .gitignore, and removed unused handleFilterChange function from CallList index.tsx.
Comment on lines +3 to +4
export default defineConfig({
projectId: "vq61f6",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get this fro cypress.io

… Filters.tsx

This commit corrects a typo in the file path for the import of callDirectionOptions and callTypeOptions in Filters.tsx. The file path has been updated from "./constats" to "./constants".
import { ApolloClient, HttpLink, InMemoryCache, split } from "@apollo/client";
import { setContext } from "@apollo/client/link/context";
import { WebSocketLink } from "@apollo/client/link/ws";
import { SubscriptionClient } from "subscriptions-transport-ws";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subscriptions-transport-ws is not maintained anymore, we need to switch to graphql-ws in the future (uses a different protocol)

Comment on lines +1 to +23
import { useEffect } from "react";
import { ApolloError } from "@apollo/client";
import { useNavigate } from "react-router-dom";
import { useToast } from "@aircall/tractor";

// Redirect to login page if the error is "Unauthorized"
const useRedirectToLogin = (error: ApolloError | undefined) => {
const navigate = useNavigate();
const { showToast } = useToast();

useEffect(() => {
if (error?.message === "Unauthorized") {
showToast({
message: "Your session has expired, please login again",
variant: "warning",
dismissIn: 5000
});
navigate("/login", { replace: true });
}
}, [error, navigate, showToast]);
};

export default useRedirectToLogin;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A hook that listens to auth error and forwards users to the login page.


useEffect(() => {
if (subscriptionData) {
refetch();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

listen to subscription and refetch

@geryit geryit marked this pull request as ready for review June 14, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant