-
Notifications
You must be signed in to change notification settings - Fork 22
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: #1125 Standalone app page #1240
Conversation
…t/1125-standalone-app-page
onUninstallSuccess={closeInstallationsModal(setIsInstallationsModalOpen)} | ||
/> | ||
|
||
<AppRevisionModal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think should unmount and remove from DOM tree modal isAppRevisionComparisionModalOpen && <AppRevisionModal ...
if we don't show it on UI
speed: 500, | ||
variableWidth: true, | ||
prevArrow: ( | ||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can write like this
const renderSlickButton = () => {
return (
<SlickButtonNav>
<ChevronLeftIcon />
</SlickButtonNav>
)
}
...
prevArrow: renderSlickButton(),
...
</SlickButtonNav> | ||
), | ||
nextArrow: ( | ||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
<GridItem className="is-8"> | ||
<HTMLRender className={styles.description} html={description} /> | ||
<br /> | ||
{carouselImages.length > 0 && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this component too long pls separate to function renderCarousel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tanphamhaiduong,
Because this view is going to be changed when building the new UI for standalone app page, refactoring these codes here will means nothing, we will still have to rework anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we may not even use the carousel. It's fine to leave
)} | ||
<br /> | ||
<Grid isMultiLine> | ||
{scopes.map(item => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this component too long pls separate to function renderScopes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tanphamhaiduong,
Because this view is going to be changed when building the new UI for standalone app page, refactoring these codes here will means nothing, we will still have to rework anyway
|
||
if (location && location.search) { | ||
const pageQueryString = getParamValueFromPath(location.search, 'page') | ||
pageNumber = Number(pageQueryString) > 0 ? Number(pageQueryString) : 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So do we need to check this Number(pageQueryString) > 0 ?
} | ||
> | ||
<> | ||
{scopes.length ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think should move this out because function render too long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tanphamhaiduong,
Because this view is going to be changed when building the new UI for standalone app page, refactoring these codes here will means nothing, we will still have to rework anyway
)} | ||
</> | ||
</Modal> | ||
<Modal visible={isSuccessAlertVisible} afterClose={handleSuccessAlertMessageAfterClose(setIsSuccessAlertVisible)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think should un mount if we don't use modal isSuccessAlertVisible && <Modal visible={isSuccessAlertVisible} ...
|
||
return ( | ||
<> | ||
<Modal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visible && Modal ...
visible={visible} | ||
title={`Confirm ${name} installation`} | ||
afterClose={closeUninstallConfirmationModal} | ||
footerItems={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This func too long pls move to renderFooterItems
function
|
||
return ( | ||
<> | ||
<Modal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unmount if we dont use it
> | ||
<>Are you sure you wish to uninstall {name}? This action will uninstall the app for ALL platform users</> | ||
</Modal> | ||
<Modal visible={isSuccessAlertVisible} afterClose={handleSuccessAlertMessageAfterClose(setIsSuccessAlertVisible)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unmount if we dont use it
visible={isConfirmationModalVisible} | ||
title="Please confirm" | ||
afterClose={() => setIsConfirmationModalVisible(false)} | ||
footerItems={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you move this to function renderItems
<p>Are you sure you wish to cancel any pending revisions for this App?</p> | ||
</Modal> | ||
|
||
<Modal visible={isDeclinedSuccessfully} afterClose={afterClose}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDeclinedSuccessfully && Modal
) : ( | ||
<AppRevisionComparision appDetailData={appDetailState.data} revisionDetailState={appRevisionDetail} /> | ||
)} | ||
<Modal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isConfirmationModalVisible && isConfirmationModalVisible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small tweaks but looks great, nice work 💯
@@ -1,9 +1,17 @@ | |||
import { actionCreator } from '../utils/actions' | |||
import ActionTypes from '../constants/action-types' | |||
import { ClientItem, ClientParams } from '../reducers/client' | |||
import { ClientAppSummary, ClientAppSummaryParams } from '../reducers/client/app-summary' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small point but @/reducers/...
} | ||
} | ||
|
||
export const renderAppHeaderButtonGroup = (id, installedOn, onInstallConfirmationModal) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add definitions to these params please?
...marketplace/src/components/pages/developer-app-detail/__test__/developer-app-detail.test.tsx
Show resolved
Hide resolved
} | ||
} | ||
|
||
export const renderAppHeaderButtonGroup = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add definitions to these params please?
const pageNumber = match.params && !isNaN(match.params.page) ? Number(match.params.page) : 1 | ||
let pageNumber = 1 | ||
|
||
if (location && location.search) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if there was a pagination util that gets this detail from the URL where required and returns 1 as the default. Not a big deal but would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't really get your idea here, can you explain it a bit more for me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a getPageFromLocation helper that would return the page number from location. It's not important though
renderUninstallConfirmationModalFooter, | ||
} from '../client-app-uninstall-confirmation' | ||
|
||
const mockState = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And again with the mock state :-)
} | ||
} | ||
|
||
export const handleSuccessAlertButtonClick = history => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This history.replace function is used a lot. Feels like we should use a util helper. Also, history is type History :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't build a util helper for history.replace and call it directly in functions like handleSuccessAlertButtonClick
because useHistory
hook can only called in a function component
import { revisionDetailRequestData } from '@/actions/revision-detail' | ||
import { developerFetchAppDetail } from '@/actions/developer' | ||
|
||
const mockState = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And again with mock state - mock state module?
error: null, | ||
} | ||
|
||
const appSumarryReducer = (state: ClientAppSummaryState = defaultState, action: Action<any>): ClientAppSummaryState => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo, summary has 1 r :-)
import { fetcher } from '@reapit/elements' | ||
import { URLS, generateHeader } from '../constants/api' | ||
|
||
export interface FetchAppDetailParams { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You define this interface but don't use it!
Also, needs a test I think for this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FetchAppDetailParams
is used in src/actions/client.ts
export const clientFetchAppDetail = actionCreator<FetchAppDetailParams>(ActionTypes.CLIENT_FETCH_APP_DETAIL)
and in src/actions/developer.ts
export const developerFetchAppDetail = actionCreator<FetchAppDetailParams>(ActionTypes.DEVELOPER_FETCH_APP_DETAIL)
I added a test for this file by the way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice one 👍
const pageNumber = match.params && !isNaN(match.params.page) ? Number(match.params.page) : 1 | ||
let pageNumber = 1 | ||
|
||
if (location && location.search) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a getPageFromLocation helper that would return the page number from location. It's not important though
@@ -0,0 +1,219 @@ | |||
import { ReduxState } from '@/types/core' | |||
|
|||
const appState: ReduxState = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Others look good to me👍
|
||
export type AppContentProps = { | ||
appDetailData: AppDetailModel & { | ||
apiKey?: string | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need | undefined
here
apiKey?: string
is enough
|
||
export type AppHeaderProps = { | ||
appDetailData: AppDetailModel & { | ||
apiKey?: string | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need |undefined
<div className={styles.appIconContainer}> | ||
<img | ||
className="image" | ||
src={(appIcon && appIcon.uri) || 'https://bulma.io/images/placeholders/48x48.png'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appIcon?.uri || 'https://...'
for short
appScopes: ScopeModel[] | undefined | ||
revisionScopes: ScopeModel[] | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appScopes?: ScopeModel[]
revisionScopes?: ScopeModel[]
Currently, as a user client or developer, I view app details in a modal. These modals have grown too small for their use case so require a standalone app page