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

Modify details page with actionbar #1564

Merged
merged 6 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions apps/sensenet/src/components/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
DeleteOutlined,
DescriptionOutlined,
DomainOutlined,
Edit,
ErrorOutlined,
EventOutlined,
FiberNew,
Expand Down Expand Up @@ -173,6 +174,10 @@ const getIconByName = (name: string | undefined, options: IconOptions) => {
return <InlineIcon icon={vercelIcon} width="24" />
case 'Heroku':
return <InlineIcon icon={herokuIcon} height="24" />
case 'Edit':
return <Edit style={options.style} />
case 'Details':
return <Info style={options.style} />
default:
return null
}
Expand Down
2 changes: 1 addition & 1 deletion apps/sensenet/src/components/view-controls/browse-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const BrowseView: React.FC<BrowseViewProps> = (props) => {
...classes,
cancel: globalClasses.cancelButton,
}}
renderTitle={() => <ViewTitle title={'Info about'} titleBold={content?.DisplayName} content={content} />}
renderTitle={() => <ViewTitle actionName="browse" titleBold={content?.DisplayName} content={content} />}
/>
)
}
127 changes: 96 additions & 31 deletions apps/sensenet/src/components/view-controls/common/view-title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import { useHistory } from 'react-router'
import { ResponsivePersonalSettings } from '../../../context'
import { useGlobalStyles } from '../../../globalStyles'
import { useSnRoute } from '../../../hooks'
import { getPrimaryActionUrl } from '../../../services'
import { getPrimaryActionUrl, getUrlForContent } from '../../../services'
import { Icon } from '../../Icon'

interface ViewTitleProps {
title: string
title?: string
titleBold?: string
content?: GenericContent
actionName?: string
}

const useStyles = makeStyles(() => {
Expand All @@ -22,10 +23,15 @@ const useStyles = makeStyles(() => {
height: '68px',
fontSize: '20px',
flexShrink: 0,
flexDirection: 'column',
flexWrap: 'nowrap',
},
textBolder: {
fontWeight: 500,
},
actionBar: {
display: 'flex',
},
})
})

Expand Down Expand Up @@ -57,37 +63,96 @@ export const ViewTitle: React.FunctionComponent<ViewTitleProps> = (props) => {

return (
<div className={clsx(classes.title, globalClasses.centered)}>
<span data-test="viewtitle">
<div data-test="viewtitle">
{props.title} <span className={classes.textBolder}>{props.titleBold}</span>
</span>
{props.content && (
<span
title={`Open ${contentDisplayName} CTD`}
onClick={async () => {
const content = await getContentTypeId(props.content!.Type)
history.push(
getPrimaryActionUrl({
content,
repository,
location: history.location,
uiSettings,
snRoute,
removePath: true,
}),
)
}}
className={globalClasses.centered}>
<Icon
style={{
marginLeft: '9px',
height: '24px',
width: '24px',
cursor: 'pointer',
</div>
<div className={clsx(classes.actionBar)}>
VargaJoe marked this conversation as resolved.
Show resolved Hide resolved
{props.actionName === 'browse' && (
<span
title={`Open ${contentDisplayName} Edit Page`}
onClick={async () => {
history.push(
getUrlForContent({
content: props.content!,
uiSettings,
location: history.location,
action: 'edit',
snRoute,
removePath: true,
}),
)
}}
className={globalClasses.centered}>
<Icon
style={{
marginLeft: '4px',
marginRight: '4px',
height: '24px',
width: '24px',
cursor: 'pointer',
}}
item={{ Icon: 'Edit' }}
/>
</span>
)}
{props.actionName === 'edit' && (
<span
title={`Open ${contentDisplayName} Details Page`}
onClick={async () => {
history.push(
getUrlForContent({
content: props.content!,
uiSettings,
location: history.location,
action: 'browse',
snRoute,
removePath: true,
}),
)
}}
className={globalClasses.centered}>
<Icon
style={{
marginLeft: '4px',
marginRight: '4px',
height: '24px',
width: '24px',
cursor: 'pointer',
}}
item={{ Icon: 'Details' }}
/>
</span>
)}
{props.content && (
<span
title={`Open ${contentDisplayName} CTD`}
onClick={async () => {
const content = await getContentTypeId(props.content!.Type)
history.push(
getPrimaryActionUrl({
content,
repository,
location: history.location,
uiSettings,
snRoute,
removePath: true,
}),
)
}}
item={{ ContentTypeName: 'ContentType' }}
/>
</span>
)}
className={globalClasses.centered}>
<Icon
style={{
marginLeft: '4px',
marginRight: '4px',
height: '24px',
width: '24px',
cursor: 'pointer',
}}
item={{ ContentTypeName: 'ContentType' }}
/>
</span>
)}
</div>
</div>
)
}
3 changes: 2 additions & 1 deletion apps/sensenet/src/components/view-controls/edit-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ export const EditView: React.FC<EditViewProps> = (props) => {
}}
renderTitle={() => (
<ViewTitle
title={props.actionName === 'browse' ? 'Info about' : 'Edit'}
title={props.actionName === 'browse' ? '' : 'Edit'}
titleBold={content?.DisplayName}
content={content}
actionName={props.actionName}
/>
)}
/>
Expand Down