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

release(v0.33.0): merge to prod #1335

Merged
merged 9 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
"rules": {
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"react/jsx-props-no-spreading": "warn",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off",
"react-hooks/exhaustive-deps": "warn",
"import/prefer-default-export": "off",
"react/prop-types": "warn",
"no-param-reassign": "warn",
Expand Down
21 changes: 17 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,25 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v0.32.0](https://github.com/isomerpages/isomercms-frontend/compare/v0.31.0...v0.32.0)

#### [v0.33.0](https://github.com/isomerpages/isomercms-frontend/compare/v0.32.0...v0.33.0)

- feat(siteLaunchPad): prevent users from accessing site launchpad [`#1324`](https://github.com/isomerpages/isomercms-frontend/pull/1324)
- Feat/site launch integration with be [`#1325`](https://github.com/isomerpages/isomercms-frontend/pull/1325)
- Fix/is 276 toast rerender [`#1333`](https://github.com/isomerpages/isomercms-frontend/pull/1333)
- fix(eslint): warn for exhausive deps [`#1331`](https://github.com/isomerpages/isomercms-frontend/pull/1331)
- Chore/modify e slint rule [`#1328`](https://github.com/isomerpages/isomercms-frontend/pull/1328)
- feat(site launch): site launch pad stories [`#1297`](https://github.com/isomerpages/isomercms-frontend/pull/1297)
- Feat(siteLaunchPad): Disclaimer pages Storybook [`#1308`](https://github.com/isomerpages/isomercms-frontend/pull/1308)
- 0.32.0 (develop) [`#1319`](https://github.com/isomerpages/isomercms-frontend/pull/1319)
- IS-271: fix bugs on simple mde editor [`#1323`](https://github.com/isomerpages/isomercms-frontend/pull/1323)
- fix(ci-e2e): inject env var from workflow [`#1322`](https://github.com/isomerpages/isomercms-frontend/pull/1322)
- feat: set cookies with domain [`#1320`](https://github.com/isomerpages/isomercms-frontend/pull/1320)
- fix(settings): use gh session defaults [`#1321`](https://github.com/isomerpages/isomercms-frontend/pull/1321)

#### [v0.32.0](https://github.com/isomerpages/isomercms-frontend/compare/v0.31.0...v0.32.0)

> 22 June 2023

- feat: handle V2 errors for create and update pages [`#1312`](https://github.com/isomerpages/isomercms-frontend/pull/1312)
- docs(setup): add docs for e2e setup [`#1314`](https://github.com/isomerpages/isomercms-frontend/pull/1314)
- Feat: Upgrade major deps and to Webpack 5 [`#1202`](https://github.com/isomerpages/isomercms-frontend/pull/1202)
Expand Down Expand Up @@ -146,14 +159,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

> 31 March 2023

- fix(app): hotfixes for header + routes [`#1216`](https://github.com/isomerpages/isomercms-frontend/pull/1216)
- fix(sites): change to using userId [`#1215`](https://github.com/isomerpages/isomercms-frontend/pull/1215)
- fix: bug in loading flag for login context [`bbae2eb`](https://github.com/isomerpages/isomercms-frontend/commit/bbae2eb3b864a2c2246524d334d051292078a9b1)

#### [v0.21.0](https://github.com/isomerpages/isomercms-frontend/compare/v0.20.0...v0.21.0)

> 30 March 2023

- fix(app): hotfixes for header + routes [`#1216`](https://github.com/isomerpages/isomercms-frontend/pull/1216)
- fix(sites): change to using userId [`#1215`](https://github.com/isomerpages/isomercms-frontend/pull/1215)
- feat(identity): phase 2 [`#1090`](https://github.com/isomerpages/isomercms-frontend/pull/1090)
- fix(mergify): update condition [`#1207`](https://github.com/isomerpages/isomercms-frontend/pull/1207)
- chore(mergify): add rule for stale PRs [`#765`](https://github.com/isomerpages/isomercms-frontend/pull/765)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "isomercms-frontend",
"version": "0.32.0",
"version": "0.33.0",
"private": true,
"engines": {
"node": ">=16.0.0"
Expand Down
1 change: 0 additions & 1 deletion src/assets/icons/BxCopy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
export const BxCopy = (props: React.SVGProps<SVGSVGElement>): JSX.Element => {
return (
<svg
Expand Down
1 change: 0 additions & 1 deletion src/assets/icons/BxLifeBuoy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
export const BxLifeBuoy = (
props: React.SVGProps<SVGSVGElement>
): JSX.Element => {
Expand Down
1 change: 0 additions & 1 deletion src/assets/icons/BxsClearRocket.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
export const BxsClearRocket = (
props: React.SVGProps<SVGSVGElement>
): JSX.Element => {
Expand Down
1 change: 0 additions & 1 deletion src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import {
Box,
BoxProps,
Expand Down
5 changes: 4 additions & 1 deletion src/components/CollaboratorModal/components/MainSubmodal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ export const MainSubmodal = ({

useEffect(() => {
if (addCollaboratorSuccess) {
successToast({ description: "Collaborator added successfully" })
successToast({
id: "add-collaborator",
description: "Collaborator added successfully",
})
collaboratorFormMethods.reset()
}
}, [addCollaboratorSuccess, collaboratorFormMethods, successToast])
Expand Down
1 change: 0 additions & 1 deletion src/components/DisplayCard/DisplayCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import {
Box,
Divider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const ContactVerificationModal = ({
const handleSendOtp = async ({ mobile: mobileInput }: ContactProps) => {
await sendContactOtp({ mobile: mobileInput }) // Non-2xx responses will be caught by axios and thrown as error
successToast({
id: "send-otp-success",
description: `OTP sent to ${mobileInput}`,
})
setMobile(mobileInput)
Expand All @@ -54,6 +55,7 @@ export const ContactVerificationModal = ({
await verifyContactOtp({ mobile, otp })
onClose()
successToast({
id: "verify-otp-success",
description: `Successfully changed contact number to ${mobile}!`,
})
verifyLoginAndGetUserDetails()
Expand Down
1 change: 1 addition & 0 deletions src/components/MediaCreationModal/MediaCreationModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const MediaCreationModal = ({
const media = event.target?.files[0] || ""
if (media.size > MEDIA_FILE_MAX_SIZE) {
errorToast({
id: "create-media-size-error",
description: "File size exceeds 5MB. Please upload a different file.",
})
} else {
Expand Down
1 change: 0 additions & 1 deletion src/components/MediaSettingsModal/MediaSettingsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ export const MediaSettingsModal = ({
<FormTitle>File name</FormTitle>
<FormField
placeholder="File name"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("name")}
id="name"
/>
Expand Down
3 changes: 0 additions & 3 deletions src/components/PageSettingsModal/PageSettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ export const PageSettingsModal = ({
<Input
placeholder="Page title"
id="title"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("title", { required: true })}
/>
<FormErrorMessage>{errors.title?.message}</FormErrorMessage>
Expand All @@ -173,7 +172,6 @@ export const PageSettingsModal = ({
</FormLabel.Description>
</Box>
<Input
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("permalink", { required: true })}
id="permalink"
placeholder="Page URL"
Expand All @@ -196,7 +194,6 @@ export const PageSettingsModal = ({
<Input
placeholder="Meta Description (Optional)"
id="description"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("description")}
/>
<FormErrorMessage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ export const ResourcePageSettingsModal = ({
<FormLabel mb={0}>Resource Type</FormLabel>
</Box>
<Select
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("layout", { required: true })}
id="layout"
value={watch("layout")}
Expand All @@ -268,7 +267,6 @@ export const ResourcePageSettingsModal = ({
<Input
placeholder="Page title"
id="title"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("title", { required: true })}
/>
<FormErrorMessage>{errors.title?.message}</FormErrorMessage>
Expand All @@ -289,7 +287,6 @@ export const ResourcePageSettingsModal = ({
</FormLabel.Description>
</Box>
<Input
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("permalink", { required: true })}
id="permalink"
placeholder="Page URL"
Expand All @@ -310,7 +307,6 @@ export const ResourcePageSettingsModal = ({
</FormLabel.Description>
</Box>
<Input
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("date", { required: true })}
id="date"
placeholder="Date (YYYY-MM-DD)"
Expand Down Expand Up @@ -362,7 +358,6 @@ export const ResourcePageSettingsModal = ({
<Input
placeholder="Meta Description (Optional)"
id="description"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("description")}
/>
<FormErrorMessage>
Expand Down
1 change: 0 additions & 1 deletion src/components/contact-us/Section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const EditorSection = ({
<>
<Droppable droppableId={sectionId} type={sectionId}>
{(droppableProvided) => (
/* eslint-disable react/jsx-props-no-spreading */
<div
className={styles.card}
ref={droppableProvided.innerRef}
Expand Down
3 changes: 0 additions & 3 deletions src/components/folders/ReorderingModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ const ReorderingModal = ({ params, dirData, onProceed, onClose }) => {
<div
className={`${contentStyles.contentContainerFolderColumn} mb-5`}
ref={droppableProvided.innerRef}
// eslint-disable-next-line react/jsx-props-no-spreading
{...droppableProvided.droppableProps}
>
{dirOrder.map((folderContentItem, folderContentIndex) => (
Expand All @@ -102,9 +101,7 @@ const ReorderingModal = ({ params, dirData, onProceed, onClose }) => {
>
{(draggableProvided) => (
<div
// eslint-disable-next-line react/jsx-props-no-spreading
{...draggableProvided.draggableProps}
// eslint-disable-next-line react/jsx-props-no-spreading
{...draggableProvided.dragHandleProps}
ref={draggableProvided.innerRef}
>
Expand Down
1 change: 0 additions & 1 deletion src/components/homepage/HeroDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ const HeroDropdown = ({
</FormContext>
<Droppable droppableId="dropdownelem" type="dropdownelem">
{(droppableProvided) => (
/* eslint-disable react/jsx-props-no-spreading */
<div
className={styles.card}
ref={droppableProvided.innerRef}
Expand Down
1 change: 0 additions & 1 deletion src/components/homepage/HeroSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ const EditorHeroSection = ({
/>
<Droppable droppableId="highlight" type="highlight">
{(droppableProvided) => (
/* eslint-disable react/jsx-props-no-spreading */
<div
className={styles.card}
ref={droppableProvided.innerRef}
Expand Down
1 change: 0 additions & 1 deletion src/components/media/MediaAltText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export const MediaAltText = ({ onProceed, onClose, type }) => {
*/}
<FormField
placeholder={formTitle}
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("altText")}
id="altText"
/>
Expand Down
1 change: 0 additions & 1 deletion src/components/navbar/NavSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ const NavSection = ({
<>
<Droppable droppableId="link" type="link">
{(droppableProvided) => (
/* eslint-disable react/jsx-props-no-spreading */
<div
className={styles.card}
ref={droppableProvided.innerRef}
Expand Down
1 change: 0 additions & 1 deletion src/components/navbar/NavSublinkSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ const NavSublinkSection = ({
}) => (
<Droppable droppableId={`sublink-${linkIndex}`} type="sublink">
{(droppableProvided) => (
/* eslint-disable react/jsx-props-no-spreading */
<div
className={styles.card}
ref={droppableProvided.innerRef}
Expand Down
51 changes: 47 additions & 4 deletions src/contexts/SiteLaunchContext.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { createContext, useContext, useEffect, useState } from "react"
import { useQueryClient } from "react-query"
import { useParams } from "react-router-dom"

import { SITE_DASHBOARD_LAUNCH_STATUS_KEY } from "constants/queryKeys"

import { useGetSiteLaunchStatus } from "hooks/siteDashboardHooks"

import { launchSite } from "services/SiteLaunchService"

import {
SiteLaunchFrontEndStatus,
SiteLaunchStatusProps,
SiteLaunchTaskTypeIndex,
SITE_LAUNCH_TASKS,
SITE_LAUNCH_TASKS_LENGTH,
} from "types/siteLaunch"

Expand All @@ -14,12 +21,14 @@ interface SiteLaunchContextProps {
setSiteLaunchStatusProps: (
siteLaunchStatusProps: SiteLaunchStatusProps
) => void
generateDNSRecords: () => void
refetchSiteLaunchStatus: () => void
}

interface SiteLaunchProviderProps {
children: React.ReactNode
initialSiteLaunchStatus?: SiteLaunchFrontEndStatus
initialStepNumber?: number
initialStepNumber?: SiteLaunchTaskTypeIndex
}

const SiteLaunchContext = createContext<SiteLaunchContextProps | null>(null)
Expand All @@ -43,11 +52,38 @@ export const SiteLaunchProvider = ({
setSiteLaunchStatusProps,
] = useState<SiteLaunchStatusProps>({
siteLaunchStatus: initialSiteLaunchStatus || "LOADING",
stepNumber: initialStepNumber || 0,
stepNumber: initialStepNumber || SITE_LAUNCH_TASKS.NOT_STARTED,
})

const { data: siteLaunchDto } = useGetSiteLaunchStatus(siteName)

const queryClient = useQueryClient()
const refetchSiteLaunchStatus = () => {
/**
* Since the site launch states are held both in FE and BE, we don't want to keep
* refreshing the state unnecessarily.
*/
queryClient.invalidateQueries([SITE_DASHBOARD_LAUNCH_STATUS_KEY, siteName])
}
const generateDNSRecords = async () => {
if (
siteLaunchStatusProps.siteUrl &&
// NOTE: we accept false values, just not undefined
siteLaunchStatusProps.useWwwSubdomain !== undefined
) {
await launchSite(
siteName,
siteLaunchStatusProps.siteUrl,
siteLaunchStatusProps.useWwwSubdomain
)
// Since this API works async, we wait for 2 minutes before refetch
// invalidate react query key
setTimeout(() => {
refetchSiteLaunchStatus()
}, 120000)
}
}

// using a UseEffect to sync the siteLaunchStatusProps with the siteLaunchDto
// this is needed because the siteLaunchDto is fetched asynchronously
useEffect(() => {
Expand All @@ -63,7 +99,8 @@ export const SiteLaunchProvider = ({
}
// this condition is added to prevent redundant re-renders
const isSiteLaunchFEAndBESynced =
siteLaunchStatusProps.siteLaunchStatus === siteLaunchDto?.siteStatus
siteLaunchStatusProps.siteLaunchStatus === siteLaunchDto?.siteStatus &&
siteLaunchStatusProps.dnsRecords === siteLaunchDto?.dnsRecords
if (
(siteLaunchDto.siteStatus === "LAUNCHED" ||
siteLaunchDto.siteStatus === "LAUNCHING") &&
Expand All @@ -75,13 +112,19 @@ export const SiteLaunchProvider = ({
dnsRecords: siteLaunchDto.dnsRecords,
})
}
}, [siteLaunchDto, siteLaunchStatusProps.siteLaunchStatus])
}, [
siteLaunchDto,
siteLaunchStatusProps.dnsRecords,
siteLaunchStatusProps.siteLaunchStatus,
])

return (
<SiteLaunchContext.Provider
value={{
siteLaunchStatusProps,
setSiteLaunchStatusProps,
generateDNSRecords,
refetchSiteLaunchStatus,
}}
>
{children}
Expand Down
Loading