-
Notifications
You must be signed in to change notification settings - Fork 59
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: Add authentication logic, improve /calls page, add filters and archive features, and new tests with jest and cypress #26
Open
danielmarcano
wants to merge
20
commits into
aircall:master
Choose a base branch
from
danielmarcano:authentication-and-calls-features-and-enhancements
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… page size change in CallsList
…List through the new CallFilters component
… create CallItem component
…refactors to useAuth
…der component and directory files
…ough new tokenExpiredLink and refreshTokenV2 mutation, and useAuth updates
…rate it within /calls routes
…ixing minor issue with /login page
…r, to support subscriptions, and update existing code accordingly
…cated, through a new PublicRoute component
…oying app to production
danielmarcano
force-pushed
the
authentication-and-calls-features-and-enhancements
branch
from
November 10, 2023 09:48
8f66175
to
54cf582
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR includes a series of changes that can be summarized in a couple of sections:
New Features
Apollo Client
subscriptions-transport-ws
package, and thewsLink.ts
Routing
ProtectedRoute
, which will redirect users to the/login
page by default if they are not authenticatedPublicRoute
, which will redirect users to the/calls
page by default if they are already authenticated/login
or the/calls
page if they visit a non-existent pageAuthentication
access_token
will now be refreshed while therefresh_token
is still active, through the newtokenExpiredLink.ts
,authLink.ts
, andrefreshTokenV2
mutationProtectedLayout
:ApolloClient
cache is cleared, which prevents the cache from leaking and mixing-up sensitive information between different user accounts.CallsListPage
:CallDetailsPage
:LoginPage
:helpers/dates.tsx
:customFormat
optional property has been passed toformatDate
function, so that we can reuse itRefactors
/ApolloClientProvider
@apollo/client
code has been moved fromApp.tsx
to/ApolloClientProvider
and placed within differentiated files that make it easier to extend the configuration and logic.helpers/localStorage.ts
andconstants/localStorageKeys.ts
The existing
hooks/useLocalStorage.ts
file has been moved tohelpers/localStorage.ts
, and the custom hook has been split in the following two regular functions:getLocalStorageItem
addOrRemoveLocalStorageItem
This was made to maintain a "single source of truth" for storing and retrieving values from the
localStorage
that could work anywhere, including regular (non-custom-hook) functions.The
constants/localStorageKeys
file has been created to maintain alllocalStorage
's keys centralized in a single place, to improve maintainability and remove hard-coded values.constants/paths.ts
This file has been created to maintain all paths centralized in a single place, to improve maintainability and remove hard-coded values.
useAuth.ts
Some of its code has changed, in particular:
user
state has been removed, as having it here was not helpful, as it was only being set when the login mutation was executed, so reloading the page while being authenticated left you with anundefined
user.status
is now being returned within theAuthProvider
values, and it is ultimately used to determine whether to redirect users or not when they visit a public or a private page, depending on whether they are authenticatedTesting
The following unit and end-to-end tests have been added:
CallsListPage
andCallDetailsPage
:cypress/e2e/calls.cy.ts
LoginPage
:cypress/e2e/login.cy.ts
helpers/dates.tsx
:helpers/dates.spec.ts
Documentation:
NEXT-DEVELOPMENT-STEPS.md
file has been created, showcasing some of our possible next steps before deploying the app to productionphone-test/README.md
file has been updated with the newyarn e2e
andyarn cypress:open
scriptsVideo:
archived-in-real-time-demo.mov