Skip to content
This repository was archived by the owner on Jan 6, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 1 addition & 3 deletions app/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ export const addDat = key => dispatch => {
})

const updateConnections = () => {
if (dat.network)
dispatch({ type: 'DAT_PEERS', key, peers: dat.network.connected })
if (dat.network) { dispatch({ type: 'DAT_PEERS', key, peers: dat.network.connected }) }
}
updateConnections()

Expand All @@ -98,7 +97,6 @@ export const addDat = key => dispatch => {

export const deleteDat = key => dispatch => {
dispatch({ type: 'REMOVE_DAT', key })
const path = `${homedir()}/Downloads/${key}`
const dat = dats.get(key)

for (const con of dat.network.connections) {
Expand Down
2 changes: 1 addition & 1 deletion app/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ const App = () => (
</Fragment>
)

export default App
export default App
9 changes: 4 additions & 5 deletions app/components/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const HeaderButton = BaseButton.extend`
}
`


var PlainButton = styled.button`
padding: .5rem .75rem;
font-size: .75rem;
Expand Down Expand Up @@ -83,31 +82,31 @@ export const Icon = ({ icon, ...props }) => (
export const Plain = ({ children, ...props }) => (
<PlainButton {...props}>
<InnerWrapperComponent>
{children}
{children}
</InnerWrapperComponent>
</PlainButton>
)

export const Green = ({ children, icon, ...props }) => (
<GreenButton {...props}>
<InnerWrapperComponent icon={icon}>
{children}
{children}
</InnerWrapperComponent>
</GreenButton>
)

export const Red = ({ children, icon, ...props }) => (
<RedButton {...props}>
<InnerWrapperComponent icon={icon}>
{children}
{children}
</InnerWrapperComponent>
</RedButton>
)

const InnerWrapperComponent = ({ children, icon }) => (
<InnerWrapper>
{icon}
<span className="btn-text ml1">
<span className='btn-text ml1'>
{children}
</span>
</InnerWrapper>
Expand Down
18 changes: 9 additions & 9 deletions app/components/dat-import.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

import React, { Component } from 'react'
import React from 'react'
import styled from 'styled-components'
import Icon from './icon'

Expand Down Expand Up @@ -62,17 +62,17 @@ const DatImport = ({ onAddDat }) => {
}

return (
<Label for="dat-import" className="relative dib pa0 b--none">
<input name="dat-import"
type="text"
placeholder="Download"
<Label for='dat-import' className='relative dib pa0 b--none'>
<input name='dat-import'
type='text'
placeholder='Download'
onKeyDown={onKeyDown}
className="input-reset f7 f6-l"
defaultValue="dat://40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9/"
className='input-reset f7 f6-l'
defaultValue='dat://40a7f6b6147ae695bcbcff432f684c7bb5291ea339c28c1755896cdeb80bd2f9/'
/>
<Icon name="link" className="absolute top-0 bottom-0 left-0" />
<Icon name='link' className='absolute top-0 bottom-0 left-0' />
</Label>
)
}

export default DatImport
export default DatImport
28 changes: 14 additions & 14 deletions app/components/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,35 +112,35 @@ const LabelInput = styled.label`

export const Link = ({ link, copied, onCopy, onExit }) => (
<div
className="modal fixed items-center justify-center top-0 left-0 h-100 w-100 z-9999"
className='modal fixed items-center justify-center top-0 left-0 h-100 w-100 z-9999'
style={{ display: link ? 'flex' : 'none' }}
>
<Inner
className="relative flex flex-column justify-center"
<Inner
className='relative flex flex-column justify-center'
>
<h3 className="f4">
<h3 className='f4'>
Copy Dat Link
</h3>
<LabelInput for="dat-link" className="relative mt4 mb4">
<LabelInput for='dat-link' className='relative mt4 mb4'>
<p className={`f7 mt0 mb0 tr absolute confirmation ${copied ? 'show-confirmation' : ''}`}>
<Icon name="check" />
<Icon name='check' />
Link copied to clipboard
</p>
<input name="dat-link" type="text" value={link || ''} className="relative dib pa0 dat-input-input"></input>
<Icon name="link" />
<button className="absolute pointer dat-input-button" title="Copy to Clipboard" aria-label="Copy to Clipboard" onClick={() => onCopy(link)}>
<Icon name="clipboard" />
<input name='dat-link' type='text' value={link || ''} className='relative dib pa0 dat-input-input' />
<Icon name='link' />
<button className='absolute pointer dat-input-button' title='Copy to Clipboard' aria-label='Copy to Clipboard' onClick={() => onCopy(link)}>
<Icon name='clipboard' />
</button>
</LabelInput>
<p className="f7 color-neutral-70">
<p className='f7 color-neutral-70'>
Anyone with this link can view your Dat.
</p>
<button
onClick={onExit}
className="absolute pointer pa0 top-0 right-0 h2 w2 bg-transparent tc exit"
aria-label="Close Modal"
className='absolute pointer pa0 top-0 right-0 h2 w2 bg-transparent tc exit'
aria-label='Close Modal'
>
<Icon name="cross" />
<Icon name='cross' />
</button>
</Inner>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/components/finder-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { shell } from 'electron'

const FinderButton = ({ dat, onClick }) => (
<Button.Icon
icon={<Icon name="open-in-finder" />}
className="row-action"
icon={<Icon name='open-in-finder' />}
className='row-action'
onClick={() => shell.openExternal(`file://${resolve(dat.path)}`, () => {})}
/>
)

export default FinderButton
export default FinderButton
8 changes: 4 additions & 4 deletions app/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ const Container = styled.header`

const Header = ({ onSubmit }) => (
<Container>
<div className="fr relative">
<div className='fr relative'>
<DatImport />
<Button.Header
icon={<Icon name="create-new-dat" style={{width: '1.2em'}} />}
className="ml2 ml3-l b--transparent v-mid color-neutral-30 hover-color-white f7 f6-l"
icon={<Icon name='create-new-dat' style={{width: '1.2em'}} />}
className='ml2 ml3-l b--transparent v-mid color-neutral-30 hover-color-white f7 f6-l'
>
Share Folder
</Button.Header>
</div>
</Container>
)

export default Header
export default Header
4 changes: 2 additions & 2 deletions app/components/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const Svg = styled.svg`
`

const Icon = ({ name, ...props }) => (
<Svg viewBox="0 0 16 16" {...props} className={`icon-${name} ${props.className || ''}`}>
<Svg viewBox='0 0 16 16' {...props} className={`icon-${name} ${props.className || ''}`}>
<use xlinkHref={`#daticon-${name}`} />
</Svg>
)

export default Icon
export default Icon
4 changes: 2 additions & 2 deletions app/components/sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react'
import datIcons from 'dat-icons/raw'

const Sprite = () => (
<div dangerouslySetInnerHTML={{__html: datIcons()}}></div>
<div dangerouslySetInnerHTML={{__html: datIcons()}} />
)

export default Sprite
export default Sprite
17 changes: 7 additions & 10 deletions app/components/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const ProgressBar = styled.div`
}
`

const ProgressSubline= styled.span`
const ProgressSubline = styled.span`
.arrow {
vertical-align: top;
}
Expand All @@ -82,7 +82,6 @@ const ProgressSubline= styled.span`
const speed = n => `${bytes(n || 0)}/s`

const Status = ({ dat }) => {
const stats = dat.stats
const progress = Math.floor((dat.progress || 0) * 100)
const progressbarLine = dat.state === 'loading'
? 'line-loading'
Expand All @@ -99,7 +98,7 @@ const Status = ({ dat }) => {
case 'loading':
progressText = (
<span>
<span className="arrow">↓ </span> {speed(netStats.downloadSpeed)}<span className="arrow ml2">↑ </span> {speed(netStats.uploadSpeed)}
<span className='arrow'>↓ </span> {speed(netStats.downloadSpeed)}<span className='arrow ml2'>↑ </span> {speed(netStats.uploadSpeed)}
</span>
)
break
Expand All @@ -109,20 +108,18 @@ const Status = ({ dat }) => {
default:
progressText = 'Paused.'
}


return (
<div>
<ProgressBar>
<div className="f6 f5-l counter">
<div className='f6 f5-l counter'>
{progress}%
</div>
<div className="bar">
<div className={`line ${progressbarLine}`} style={{width: `${progress}%`}}>
</div>
<div className='bar'>
<div className={`line ${progressbarLine}`} style={{width: `${progress}%`}} />
</div>
</ProgressBar>
<p className="f7 f6-l color-neutral-60 truncate">
<p className='f7 f6-l color-neutral-60 truncate'>
<ProgressSubline>
{progressText}
</ProgressSubline>
Expand All @@ -131,4 +128,4 @@ const Status = ({ dat }) => {
)
}

export default Status
export default Status
56 changes: 28 additions & 28 deletions app/components/table-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,32 +110,32 @@ const HexContent = ({ dat }) => {
if (dat.state === 'loading') {
return (
<Button.Icon
icon={<Icon name="hexagon-down" className="w2" />}
className="color-blue hover-color-blue-hover ph0"
icon={<Icon name='hexagon-down' className='w2' />}
className='color-blue hover-color-blue-hover ph0'
/>
)
}
if (dat.state === 'paused') {
return (
<Button.Icon
icon={<Icon name="hexagon-resume" className="w2" />}
className="color-neutral-30 hover-color-neutral-40 ph0"
icon={<Icon name='hexagon-resume' className='w2' />}
className='color-neutral-30 hover-color-neutral-40 ph0'
/>
)
}
if (dat.state === 'complete') {
return (
<Button.Icon
icon={<Icon name="hexagon-up" className="w2" />}
className="color-green hover-color-green-hover ph0"
icon={<Icon name='hexagon-up' className='w2' />}
className='color-green hover-color-green-hover ph0'
/>
)
}

return (
<Button.Icon
icon={<Icon name="hexagon-x" className="w2" />}
className="color-neutral-30 hover-color-neutral-40 ph0"
icon={<Icon name='hexagon-x' className='w2' />}
className='color-neutral-30 hover-color-neutral-40 ph0'
/>
)
}
Expand All @@ -146,61 +146,61 @@ const NetworkIcon = ({ dat }) => {
: dat.peers === 1
? 'network-peers-1'
: 'network-peers-many'
return <Icon name="network" className={iconClass} />
return <Icon name='network' className={iconClass} />
}

const LinkButton = ({ ...props }) => (
<Button.Icon
icon={<Icon name="link" />}
className="row-action"
icon={<Icon name='link' />}
className='row-action'
{...props}
/>
)

const DeleteButton = ({ ...props }) => (
<Button.Icon
icon={<Icon name="delete" />}
className="row-action"
{ ...props }
icon={<Icon name='delete' />}
className='row-action'
{...props}
/>
)

const TitleField = ({ dat }) => (
<div>
<h2 className="f6 f5-l normal truncate pr3">
<h2 className='f6 f5-l normal truncate pr3'>
{dat.metadata.title || `#${dat.key}`}
</h2>
</div>
)

const Row = ({ dat, shareDat, onDeleteDat }) => (
<Tr>
<td className="cell-1">
<div className="w2 center">
<td className='cell-1'>
<div className='w2 center'>
<HexContent dat={dat} />
</div>
</td>
<td className="cell-2">
<div className="cell-truncate">
<td className='cell-2'>
<div className='cell-truncate'>
<TitleField dat={dat} />
<p className="f7 f6-l color-neutral-60 truncate">
<span className="author">{dat.metadata.author || 'Anonymous'} • </span>
<span className="title">{dat.writable ? 'Read & Write' : 'Read-only'}</span>
<p className='f7 f6-l color-neutral-60 truncate'>
<span className='author'>{dat.metadata.author || 'Anonymous'} • </span>
<span className='title'>{dat.writable ? 'Read & Write' : 'Read-only'}</span>
</p>
</div>
</td>
<td className="cell-3">
<td className='cell-3'>
<Status dat={dat} />
</td>
<td className="f6 f5-l cell-4 size">
<td className='f6 f5-l cell-4 size'>
{bytes(dat.stats.length || 0)}
</td>
<NetworkContainer className="cell-5">
<NetworkContainer className='cell-5'>
<NetworkIcon dat={dat} />
<span className="network v-top f6 f5-l ml1">{dat.peers}</span>
<span className='network v-top f6 f5-l ml1'>{dat.peers}</span>
</NetworkContainer>
<td className="cell-6">
<IconContainer className="flex justify-end">
<td className='cell-6'>
<IconContainer className='flex justify-end'>
<FinderButton dat={dat} />
<LinkButton onClick={() => shareDat(`dat://${dat.key}`)} />
<DeleteButton onClick={() => onDeleteDat(dat.key)} />
Expand Down
Loading