Skip to content

Commit e7146aa

Browse files
committed
improving var names
1 parent ee24dcf commit e7146aa

File tree

4 files changed

+28
-22
lines changed

4 files changed

+28
-22
lines changed

web/src/components/Button/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import './Button.scss'
55

66
export type ButtonProps = {
77
size?: 'small' | 'medium' | 'large'
8-
text: string
8+
text: React.ReactNode
99
onClick?: () => void
1010
icon?: string
1111
className?: string

web/src/components/JoinProjectModal/JoinProjectModal.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import React, { useState, useEffect } from 'react'
1+
import React, { useState } from 'react'
22
import './JoinProjectModal.scss'
33

4-
import Icon from '../Icon/Icon'
5-
64
import ValidatingFormInput from '../ValidatingFormInput/ValidatingFormInput'
75
import Modal from '../Modal/Modal'
86
import {
@@ -13,6 +11,7 @@ import {
1311
ProjectModalSubHeading,
1412
} from '../ProjectModal/ProjectModal'
1513
import ButtonWithPendingState from '../ButtonWithPendingState/ButtonWithPendingState'
14+
import { CellIdString } from '../../types/shared'
1615

1716
function JoinProjectForm({
1817
checkDone,
@@ -22,7 +21,7 @@ function JoinProjectForm({
2221
pendingJoiningProject,
2322
onClickDone,
2423
}) {
25-
const validateButtonContent = (
24+
const joinProjectButtonContent = (
2625
<ButtonWithPendingState
2726
pending={pendingJoiningProject}
2827
pendingText="joining..."
@@ -52,11 +51,11 @@ function JoinProjectForm({
5251
</ProjectModalContent>
5352
</ProjectModalContentSpacer>
5453
<ProjectModalButton
55-
text={validateButtonContent}
54+
text={joinProjectButtonContent}
5655
onClick={onClickDone}
5756
// show the button as disabled if there is a text about invalid secret input
5857
// or if there is no input
59-
disabled={invalidText !== '' || projectSecret === ''}
58+
disabled={invalidText !== '' || projectSecret === ''}
6059
/>
6160
</div>
6261
)
@@ -80,20 +79,21 @@ function ProjectJoinFollowUp({ onDone, checkDone }) {
8079
required before you can access it.
8180
</div>
8281
</ProjectModalContent>
83-
<ProjectModalButton
84-
text="I understand"
85-
onClick={onDone}
86-
disabled={false}
87-
/>
82+
<ProjectModalButton text="I understand" onClick={onDone} />
8883
</div>
8984
)
9085
}
9186

9287
export default function JoinProjectModal({
9388
showModal,
9489
onClose,
95-
onJoinProject,
96-
joinedProjectsSecrets = [], // defaulting to an empty array if not provided
90+
doJoinProject,
91+
joinedProjectsSecrets,
92+
}: {
93+
showModal: boolean
94+
onClose: () => void
95+
doJoinProject: (projectSecret: string) => Promise<CellIdString>
96+
joinedProjectsSecrets: string[]
9797
}) {
9898
const reset = () => {
9999
setProjectSecret('')
@@ -110,7 +110,7 @@ export default function JoinProjectModal({
110110
const onClickDone = async () => {
111111
setPendingJoiningProject(true)
112112
try {
113-
await onJoinProject(projectSecret)
113+
await doJoinProject(projectSecret)
114114
setCheckDone(true)
115115
setPendingJoiningProject(false)
116116
} catch (e) {

web/src/components/ProjectModal/ProjectModal.js renamed to web/src/components/ProjectModal/ProjectModal.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import './ProjectModal.scss'
44
import Button from '../Button/Button'
55
import Typography from '../Typography/Typography'
66

7-
function ProjectModalHeading({ title }) {
7+
function ProjectModalHeading({ title }: { title: string }) {
88
return (
99
<div className="project-modal-heading">
1010
<Typography style="heading-modal">{title}</Typography>
1111
</div>
1212
)
1313
}
1414

15-
function ProjectModalSubHeading({ title }) {
15+
function ProjectModalSubHeading({ title }: { title: string }) {
1616
return (
1717
<div className="project-modal-subheading">
1818
<Typography style="subtitle-modal">{title}</Typography>
@@ -24,7 +24,15 @@ function ProjectModalContent({ children }) {
2424
return <div className="project-modal-content">{children}</div>
2525
}
2626

27-
function ProjectModalButton({ text, onClick, disabled }) {
27+
function ProjectModalButton({
28+
text,
29+
onClick,
30+
disabled,
31+
}: {
32+
text: React.ReactNode
33+
onClick: () => void
34+
disabled?: boolean
35+
}) {
2836
return (
2937
<div className="project-modal-button">
3038
<Button text={text} onClick={onClick} disabled={disabled} />

web/src/routes/Dashboard/Dashboard.component.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ const Dashboard: React.FC<DashboardProps> = ({
9797
project: { name: string; image: string },
9898
passphrase: string
9999
) => createProject(agentAddress, project, passphrase)
100-
101-
const onJoinProject = (passphrase: string) => joinProject(passphrase)
102-
100+
const doJoinProject = (passphrase: string) => joinProject(passphrase)
103101
const onImportProject = (
104102
cellIdString: CellIdString,
105103
projectData: any,
@@ -260,7 +258,7 @@ const Dashboard: React.FC<DashboardProps> = ({
260258
onClose={() => setShowCreateModal(false)}
261259
/>
262260
<JoinProjectModal
263-
onJoinProject={onJoinProject}
261+
doJoinProject={doJoinProject}
264262
showModal={showJoinModal}
265263
onClose={() => setShowJoinModal(false)}
266264
joinedProjectsSecrets={joinedProjectsSecrets}

0 commit comments

Comments
 (0)