Skip to content

Commit

Permalink
UI: update sync conflict modal message
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdulrhmnGhanem committed Nov 7, 2022
1 parent a5342ed commit 0517f42
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/NewProject/ConflictModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ConflictModal = ({
open={conflictModalOpen}
onClose={onClose}
>
<Modal.Header>Heads up!</Modal.Header>
<Modal.Header>A project with that name already exists.</Modal.Header>
<Modal.Content>
<p>{message}</p>
<Form>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/NewProject/Sync/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Sync = ({ setUserOp }) => {
const [loading, setLoading] = useState(false)
const [message, setMessage] = useState({})
const [conflictModalOpen, setConflictModalOpen] = useState(false)
const projectName = urlToName(form.url)
const repoName = urlToName(form.url)

const uid = user?.id
const username = user?.username
Expand Down Expand Up @@ -134,7 +134,7 @@ const Sync = ({ setUserOp }) => {
const repoName = urlToName(repoURL)

const deletedRepoSuccessfully = await deleteRepo(
`${user.username}/${projectName}`,
`${user.username}/${repoName}`,
apiToken,
)

Expand All @@ -154,7 +154,7 @@ const Sync = ({ setUserOp }) => {

setLoading(false)
setMessage({
content: `Couldn't overwrite "${projectName}"`,
content: `Couldn't overwrite "${repoName}"`,
color: 'red',
})
}
Expand Down Expand Up @@ -205,7 +205,7 @@ const Sync = ({ setUserOp }) => {
</div>
<SyncConflictModal
conflictModalOpen={conflictModalOpen}
originalProjectName={projectName}
originalProjectName={repoName}
onClose={() => {
setUserOp(NoOp)
// Close the modal
Expand Down
4 changes: 2 additions & 2 deletions frontend/test/ConflictModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ it('opens conflict modal if the project name conflict with existing project', as
// Click the Sync button
fireEvent.click(screen.getByText('Sync'))
// Wait the modal to appear
await screen.findByText('Heads up!')
await screen.findByText('A project with that name already exists.')
// It should set the userOp to sync
expect(setUserOp).toHaveBeenCalled()

Expand Down Expand Up @@ -82,7 +82,7 @@ it('changes the overwrite button to OK if the new project name does not cause co
// Click the Sync button
fireEvent.click(screen.getByText('Sync'))
// Wait the modal to appear.
await screen.findByText('Heads up!')
await screen.findByText('A project with that name already exists.')

const conflictModalInput = screen.getAllByRole('textbox')[1] as HTMLInputElement
// Change the project name.
Expand Down

0 comments on commit 0517f42

Please sign in to comment.