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(arcgis): auth slice #332

Merged
merged 10 commits into from
Dec 20, 2023
Merged

Conversation

mspivak-actionengine
Copy link
Collaborator

No description provided.

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-332.d3nof3l3x2sso4.amplifyapp.com

src/utils/arcgis-auth.ts Outdated Show resolved Hide resolved
src/components/layers-panel/layers-control-panel.tsx Outdated Show resolved Hide resolved
src/components/layers-panel/layers-control-panel.tsx Outdated Show resolved Hide resolved
src/components/layers-panel/layers-control-panel.tsx Outdated Show resolved Hide resolved
src/redux/slices/arcgis-auth-slice.ts Outdated Show resolved Hide resolved
src/redux/slices/arcgis-auth-slice.ts Outdated Show resolved Hide resolved
src/redux/slices/arcgis-auth-slice.ts Outdated Show resolved Hide resolved
src/redux/store.ts Outdated Show resolved Hide resolved
src/components/layers-panel/layers-control-panel.tsx Outdated Show resolved Hide resolved
src/utils/arcgis-auth.ts Show resolved Hide resolved
@mspivak-actionengine mspivak-actionengine marked this pull request as ready for review December 14, 2023 10:10
Copy link
Collaborator

@belom88 belom88 left a comment

Choose a reason for hiding this comment

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

"You are logged in as" should not be bold:
image

src/components/modal-dialog/modal-dialog.tsx Outdated Show resolved Hide resolved
src/components/modal-dialog/modal-dialog.tsx Outdated Show resolved Hide resolved
src/components/modal-dialog/modal-dialog.tsx Outdated Show resolved Hide resolved
src/redux/slices/arcgis-auth-slice.ts Outdated Show resolved Hide resolved
src/redux/slices/arcgis-auth-slice.ts Outdated Show resolved Hide resolved
src/pages/arcgis-auth-popup/arcgis-auth-popup.tsx Outdated Show resolved Hide resolved
Comment on lines 41 to 42
<AuthContainer id="dashboard-container" layout={layout}>
</AuthContainer>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<AuthContainer id="dashboard-container" layout={layout}>
</AuthContainer>
<AuthContainer id="auth-container" layout={layout} />

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not done

src/pages/arcgis-auth-popup/arcgis-auth-popup.tsx Outdated Show resolved Hide resolved
@@ -0,0 +1,118 @@
import styled, { useTheme } from "styled-components";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add unit tests for the file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

</IconContainer>
<ContentContainer>
<Title>{title}</Title>
{typeof content === "function" ? content() : content}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would use "children" for the custom content. content() option is not clear. It is an unnecessary complexity on my opinion. It is always possible to call it in the parent component if needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment on lines 41 to 42
<AuthContainer id="dashboard-container" layout={layout}>
</AuthContainer>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not done

@@ -0,0 +1,43 @@
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add test for the slice

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

OLD_ENV = process.env;
});

describe("getAuthenticatedUser", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The test suite is testing "getAuthenticatedUser", "arcGisRequestLogin" and "arcGisRequestLogout", but the describe is about only getAuthenticatedUser

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

expect(email).toEqual(mockEmailExpected);
});

it("Should return session", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The description is about "getAuthenticatedUser Should return session" but testing getAuthenticatedUser instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

display: flex;
justify-content: center;
align-items: center;
background: #00000099;
Copy link
Collaborator

Choose a reason for hiding this comment

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

By figma:
#232430 50% . Use global constants for colors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

display: flex;
flex-direction: column;
border-radius: 8px;
background: ${({ theme }) => theme.colors.mainColor};
Copy link
Collaborator

Choose a reason for hiding this comment

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

This background is not by Figma (white theme).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

const theme = useTheme();

return (
<Overlay>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Overlay trasparency is applied on child components. We cannot use this approach. Instead, we should create another WrapperContainer with position: fixed and so on with visibility: hidden. We set visibility: visible for the child and it will be shown in the center.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The version that is submitted uses this approach, but actually it doesn't work. The problem is that the "ModalDialog" component is a child of some other component that uses opaque. It's out of my control.
I think we have to use the Popover that renders the dialog in the body, out of any other components.

Copy link
Collaborator

@belom88 belom88 left a comment

Choose a reason for hiding this comment

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

2 minor comment. Fix and merge

const onCancel = jest.fn();
const onConfirm = jest.fn();

const callRender = (renderFunc, props = {}, store = setupStore()) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fix warning

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

<Overlay />
<WrapperContainer>
<Container data-testid="modal-dialog-content">
<IconContainer>
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you add cursor: pointer for the close button?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@mspivak-actionengine mspivak-actionengine merged commit dd8a771 into ms/arcgis-connect Dec 20, 2023
3 checks passed
@mspivak-actionengine mspivak-actionengine deleted the ms/arcgis-auth-slice branch December 20, 2023 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants