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

Feat/upgrade #171

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
16 changes: 3 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
dist: focal
language: node_js
matrix:
fast_finish: true
node_js:
- '8'
- '20'
branches:
except:
- build
env:
global:
- CXX=g++-4.8
# GITHUB_TOKEN for yarn deploy script
# to generate yours : travis encrypt GITHUB_TOKEN=<your_GITHUB_TOKEN> -r cozy/cozy-sandbox --org
# REGISTRY_TOKEN for yarn cozyPublish script
# to generate yours : travis encrypt REGISTRY_TOKEN=<your_REGISTRY_TOKEN> -r cozy/cozy-sandbox --org
# N.B.: the --org option is needed only for public repositories
- secure: FeRG/wfbiA+tj5BnxFvAnoVeU2EL93UNR1CqbYboMPv7RsbPvxarbkt9whkf1dVCAj1xIWzHrQnPOl0yIvt2FKFu/rJcuf0jc4Ab7SuBFsKJ5U7620FOuL5IZh/tklP8nlM0BI8xCHOj6ZsUei4qKe3gsO2dcjazYXzG8eKY6x02KY2rv6u0BfWtgU16BouazcQwVzTehcyxWUMwM6rzagwiYA8bDu4Qp+L8NiFay+IjRQVIIPJ05wLG2hY8+cBnObcAFWNaTtA7BFJn77uW9NmHM32/b56obikgrKxyJkZwIrj1QM08+idTPTxwnh3KIzpAudBvyoCks5WrKpJfjMmMEWjwKipdzcFE9HT9/gG8+JSHecUkmtAcMt5h2MSwgJfmdU12i211/xUbBWv496m9cYGtW7lMHG0lOGOGwHmiRNtOuW2kwqR4l1UOC2GNOWbBzvf32+SEIvIJ/kZXSsmQC/nN5YUjh2MYWzZc2onqjG6J1Xy28lkGOF6Qkio78NxfjHXgcSqn8ZbkHxZaqzPJFPTQi2oeR1ZbPkxEanRuQMsqB/0qpY6F593ibYAobx6cYj37RwaQ9qN5DGQDoYRLVydMQUislM94JEba4C2CLLpz2CjqmfV44nD+PB7nc2asKyd9CFq66hezOThlIg/xY/P8j3QqIktZSACr6nU=
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- deadsnakes
packages:
- g++-4.8
- python3.5
cache:
yarn: true
directories:
- node_modules
npm: false
script:
- yarn lint
- yarn test --runInBand
Expand Down
20 changes: 0 additions & 20 deletions jest.config.js

This file was deleted.

33 changes: 13 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"watch:mobile": "cozy-scripts watch --mobile",
"start": "cozy-scripts start --hot --browser",
"deploy": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build} --repo=${DEPLOY_REPOSITORY:-https://[email protected]/cozy/cozy-sandbox.git}",
"test": "cozy-scripts test --verbose --coverage",
"test": "jest --passWithNoTests",
"cozyPublish": "git fetch origin ${DEPLOY_BRANCH:-build}:${DEPLOY_BRANCH:-build} && cozy-scripts publish --token $REGISTRY_TOKEN --build-commit $(git rev-parse ${DEPLOY_BRANCH:-build})"
},
"repository": {
Expand All @@ -30,28 +30,21 @@
},
"homepage": "https://github.com/cozy/cozy-sandbox#readme",
"devDependencies": {
"babel-core": "7.0.0-bridge.0",
"babel-preset-cozy-app": "1.2.1",
"enzyme": "3.9.0",
"enzyme-adapter-react-16": "1.7.0",
"eslint-plugin-prettier": "3.0.1",
"eslint-plugin-react": "7.11.1",
"babel-preset-cozy-app": "2.1.0",
"git-directory-deploy": "1.5.1",
"prettier": "1.15.2",
"react-hot-loader": "4.8.0",
"react-test-renderer": "16.7.0",
"stylint": "1.5.9"
"stylint": "2.0.0"
},
"dependencies": {
"cozy-bar": "6.10.0",
"cozy-client": "6.49.0",
"cozy-client-js": "0.14.2",
"cozy-interapp": "0.4.6",
"cozy-scripts": "1.13.0",
"cozy-ui": "17.2.0",
"eslint-config-cozy-app": "1.1.4",
"react": "16.7.0",
"react-dom": "16.7.0",
"cozy-bar": "7.28.0",
"cozy-client": "42.2.0",
"cozy-flags": "^3.1.0",
"cozy-intent": "^2.18.0",
"cozy-interapp": "0.8.1",
"cozy-scripts": "8.1.2",
"cozy-ui": "95.6.0",
"eslint-config-cozy-app": "6.1.0 ",
"react": "16.14.0",
"react-dom": "16.14.0",
"react-router-dom": "4.3.1"
}
}
5 changes: 3 additions & 2 deletions src/components/Accounts.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import { Button } from 'cozy-ui/react/Button'
import Button from 'cozy-ui/transpiled/react/Buttons'
import VerboseIntentOpener from './VerboseIntentOpener'

const Accounts = () => (
Expand All @@ -14,8 +14,9 @@ const Accounts = () => (
options={{
slug: 'trainline'
}}
closable={false}
>
<Button>Create account for Trainline</Button>
<Button label={'Create account for Trainline'} />
</VerboseIntentOpener>
</div>
)
Expand Down
14 changes: 8 additions & 6 deletions src/components/App.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react'
import { hot } from 'react-hot-loader'
import { Route, Switch, Redirect, HashRouter } from 'react-router-dom'

import { Layout, Main, Content } from 'cozy-ui/react/Layout'
import { Sprite as IconSprite } from 'cozy-ui/react/Icon'
import { Layout, Main, Content } from 'cozy-ui/transpiled/react/Layout'
import IconSprite from 'cozy-ui/transpiled/react/Icon/Sprite'
import Sidebar from './Sidebar'
import Intents from './Intents'

const App = () => (

const App = () =>
{
return (
<HashRouter>
<Layout>
<Sidebar />
Expand All @@ -23,12 +25,12 @@ const App = () => (
<IconSprite />
</Layout>
</HashRouter>
)
)}

/*
Enable Hot Module Reload using `react-hot-loader` here
We enable it here since App is the main root component
No need to use it anywhere else, it sould work for all
child components
*/
export default hot(module)(App)
export default App
4 changes: 2 additions & 2 deletions src/components/Apps.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import { Button } from 'cozy-ui/react/Button'
import Button from 'cozy-ui/transpiled/react/Buttons'
import VerboseIntentOpener from './VerboseIntentOpener'

const Apps = () => (
Expand All @@ -15,7 +15,7 @@ const Apps = () => (
slug: 'trainline'
}}
>
<Button>Install app Trainline</Button>
<Button label={'Install app Trainline'} />
</VerboseIntentOpener>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/Claudy.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'

import VerboseIntentOpener from './VerboseIntentOpener'
import { Button } from 'cozy-ui/react/Button'
import Button from 'cozy-ui/transpiled/react/Buttons'

class ClaudyIntent extends React.Component {
render() {
Expand All @@ -17,7 +17,7 @@ class ClaudyIntent extends React.Component {
}
onDismiss={() => alert('intent has been dismissed !')}
>
<Button>Open Claudy</Button>
<Button label={'Open Claudy'} />
</VerboseIntentOpener>
</div>
)
Expand Down
12 changes: 5 additions & 7 deletions src/components/Custom.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'

import VerboseIntentOpener from './VerboseIntentOpener'
import { Button } from 'cozy-ui/react/Button'
import Input from 'cozy-ui/react/Input'
import Textarea from 'cozy-ui/react/Textarea'
import Label from 'cozy-ui/react/Label'
import Button from 'cozy-ui/transpiled/react/Buttons'
import Input from 'cozy-ui/transpiled/react/Input'
import Textarea from 'cozy-ui/transpiled/react/Textarea'
import Label from 'cozy-ui/transpiled/react/Label'

class FileIntent extends React.Component {
constructor() {
Expand Down Expand Up @@ -109,9 +109,7 @@ class FileIntent extends React.Component {
}
onDismiss={() => alert('intent has been dismissed !')}
>
<Button disabled={!action || !doctype}>
Shake the magic box and see
</Button>
<Button disabled={!action || !doctype} label={'Shake the magic box & see'} />
</VerboseIntentOpener>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/FileIntent.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'

import VerboseIntentOpener from './VerboseIntentOpener'
import { Button } from 'cozy-ui/react/Button'
import Button from 'cozy-ui/transpiled/react/Buttons'

class FileIntent extends React.Component {
constructor() {
Expand Down Expand Up @@ -36,7 +36,7 @@ class FileIntent extends React.Component {
}
onDismiss={() => alert('intent has been dismissed !')}
>
<Button disabled={!this.state.fileId}>Open file</Button>
<Button disabled={!this.state.fileId} label={"Open File"} />
</VerboseIntentOpener>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/PickFolder.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import { Button } from 'cozy-ui/react/Button'
import Button from 'cozy-ui/transpiled/react/Buttons'
import VerboseIntentOpener from './VerboseIntentOpener'

const Apps = () => (
Expand All @@ -16,7 +16,7 @@ const Apps = () => (
}}
size={'xlarge'}
>
<Button>Pick folder</Button>
<Button label={'Pick Folder'} />
</VerboseIntentOpener>
</div>
)
Expand Down
15 changes: 9 additions & 6 deletions src/components/Sidebar.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React from 'react'
import Icon from 'cozy-ui/react/Icon'
import { translate } from 'cozy-ui/react/I18n'
import Nav, { NavItem, genNavLink } from 'cozy-ui/react/Nav'
import UISidebar from 'cozy-ui/react/Sidebar'
import Icon from 'cozy-ui/transpiled/react/Icon'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
import Nav, { NavItem, genNavLink } from 'cozy-ui/transpiled/react/Nav'
import UISidebar from 'cozy-ui/transpiled/react/Sidebar'
import { NavLink as RNavLink } from 'react-router-dom'
import NavIcon from '../assets/icons/icon-bullet-point.svg'

const NavLink = genNavLink(RNavLink)

export const Sidebar = ({ t }) => (
const Sidebar = () => {
const { t } = useI18n()
return (
<UISidebar>
<Nav>
<NavItem>
Expand All @@ -20,5 +22,6 @@ export const Sidebar = ({ t }) => (
</Nav>
</UISidebar>
)
}

export default translate()(Sidebar)
export default Sidebar
36 changes: 7 additions & 29 deletions src/components/VerboseIntentOpener.jsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,24 @@
import React from 'react'
import IntentOpener from 'cozy-ui/react/IntentOpener'
import { Consumer } from './ClientProvider'
import IntentOpener from 'cozy-ui/transpiled/react/deprecated/IntentOpener'
import { useClient } from 'cozy-client'

class _VerboseIntentOpener extends React.Component {
constructor() {
super()
this.handleChange = this.handleChange.bind(this)
this.state = { v2: false }
}
handleChange(ev) {
this.setState({ v2: ev.target.checked })
}

render() {
const { client, ...forwardProps } = this.props
const { action, doctype, options } = this.props
const { v2 } = this.state
const create = v2 ? client.intents.create.bind(client.intents) : undefined
const VerboseIntentOpener = props => {
const client = useClient()
const { ...forwardProps } = props
const { action, doctype, options } = props
return (
<div>
Client V2 :{' '}
<input checked={v2} type="checkbox" onChange={this.handleChange} />
<br />
<pre>
Action: {action}
{'\n'}
Doctype: {doctype}
{'\n'}
Options: {JSON.stringify(options, null, 2)}
</pre>
<IntentOpener create={create} {...forwardProps} />
<IntentOpener create={client.intents.create} {...forwardProps} />
</div>
)
}
}

const VerboseIntentOpener = props => {
return (
<Consumer>
{client => <_VerboseIntentOpener client={client} {...props} />}
</Consumer>
)
}

export default VerboseIntentOpener
1 change: 0 additions & 1 deletion src/styles/index.styl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@require 'cozy-ui/build'
@require './nav.css'

.app-content
Expand Down
1 change: 0 additions & 1 deletion src/targets/browser/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<meta name="format-detection" content="telephone=no">
<script src="cordova.js" defer></script>
<% } else if (__STACK_ASSETS__) { %>
{{.CozyClientJS}}
{{.CozyBar}}
<% } else { %>
<link rel="stylesheet" type="text/css" href="//{{.Domain}}/assets/fonts/fonts.css">
Expand Down
Loading