Skip to content

Commit

Permalink
fix: disable publish button if no history
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswhong authored and b5 committed Sep 3, 2019
1 parent 7790a88 commit f4a673e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/components/Dataset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export default class Dataset extends React.Component<DatasetProps> {
publishButton = published ? (
<HeaderColumnButtonDropdown
onClick={() => { shell.openExternal(`${QRI_CLOUD_URL}/${workingDataset.peername}/${workingDataset.name}`) }}
icon='faCloud'
icon={faCloud}
label='View in Cloud'
items={[
<a key={0} onClick={(e) => { shell.openExternal(`${QRI_CLOUD_URL}/${workingDataset.peername}/${workingDataset.name}`); e.stopPropagation() }}>Copy Link</a>,
Expand All @@ -271,6 +271,7 @@ export default class Dataset extends React.Component<DatasetProps> {
label='Publish'
icon={faCloudUploadAlt}
tooltip={'Publish this dataset on the Qri network'}
disabled={workingDataset.history.value.length === 0}
onClick={this.publishUnpublishDataset}
/>
)
Expand Down
6 changes: 4 additions & 2 deletions app/components/chrome/HeaderColumnButton.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import * as React from 'react'
import classNames from 'classNames'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { IconDefinition } from '@fortawesome/free-regular-svg-icons'

export interface HeaderColumnButtonProps {
tooltip?: string
label?: string
icon: IconDefinition | React.ReactElement
disabled?: boolean
onClick?: (event: React.MouseEvent) => void
}

const HeaderColumnButton: React.FunctionComponent<HeaderColumnButtonProps> = (props) => {
const { icon, label, tooltip, onClick } = props
const { icon, label, tooltip, disabled, onClick } = props

return (
<div
className='header-column'
className={classNames('header-column', { disabled })}
data-tip={tooltip}
onClick={onClick}
>
Expand Down
8 changes: 8 additions & 0 deletions app/scss/_dataset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ $header-font-size: .9rem;
align-items: center;
position: relative;

&.disabled {
color: #66737b;
pointer-events: none;
&:hover {
background-color: inherit;
}
}

&.header-column-dropdown, &.current-dataset {
padding-right: 0;
}
Expand Down
4 changes: 4 additions & 0 deletions app/utils/registry.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@

<<<<<<< HEAD
export const QRI_CLOUD_URL = 'https://qri.cloud'
=======
export const QRI_CLOUD_URL = 'http://qri.cloud'
>>>>>>> fix: disable publish button if no history

0 comments on commit f4a673e

Please sign in to comment.