Code Monkey home page Code Monkey logo

cozy-bar's Introduction

Travis build status shield NPM release version shield NPM Licence shield

Cozy Bar Library

What's Cozy?

Cozy Logo

Cozy is a platform that brings all your web services in the same private space. With it, your webapps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one's tracking you.

What's CozyBar ?

The CozyBar is a banner on the top of your application, responsible of cross-apps navigation, user facilities, intents, etc. This is a React component.

Getting started

The library requires your markup to contain an element with role=application. The DOM of the banner will be added before this element.

Installation

yarn add cozy-bar

How to use

You need to include the BarComponent into your react tree :

import { BarComponent } from 'cozy-bar'

<BarComponent />

The BarComponent will get default params into data-cozy attribute of the element role=application. You can still customize this parameter through props:

  • appName: The name of the app.
  • appNamePrefix: The prefix of the app. Originally used for apps maintained by Cozy Cloud teams.
  • appSlug: The slug of the app.
  • iconPath: The path to the app icon. Defaults to a blank GIF

There is also other parameter to adapt the bar to your app:

  • isInvertedTheme: To make the icon of Cozy(icon-cozy-home.svg) compatible with an inverted theme
  • isPublic: To show the public version of the Bar
  • onLogout: A callback to react to the logout of the user
  • disableInternalStore: Allow to disable the internal store of the Bar

Customizing the content of the bar

From within your app, you can decide to take over certain areas of the cozy-bar. This might especially be useful on mobile where the area it occupies is prime real estate — we generally don't recommend to use this option on larger screen resolutions.

The bar is divided in 4 areas that you can control individually : left, center, search and right:

cozy-bar-triplet

To do this, you need to wrap your BarComponent into an BarProvider after your can use component to modify component inside :

import { BarLeft, BarCenter, BarRight, BarSearch } from 'cozy-bar'

// then, somewhere in a render function below the BarProvider
<BarLeft>
  <div>Hello!</div>
</BarLeft>

Access your application store in custom components

By default, the Bar has its own redux store to fetch data and manage ui state. If you are using a Redux store into your application and you need to access it into your Bar customization you need to integrate the cozy-bar store into your own.

import { barReducers } from 'cozy-bar'

const reducers = {
  ...baseReducers,
  ...barReducers,
  cozy: client.reducer()
}

const appReducer = combineReducers(reducers)

You also need to disable the internal store onto the BarComponent with the property disableInternalStore

<BarComponent disableInternalStore />

Change theme bar

It's possible to update theme on the cozy-bar with setTheme function using the bar context

import { useBarContext } from 'cozy-bar'

const { setTheme } = useBarContext()

setTheme('default')
setTheme('primary')

Migrate from previous version

If you're migrating from v7, check out the migration guide for v7. If you're migrating from an other version, check out the migration guide. If you need to find the code for v7, it is on the v7-stable branch.

Debugging

It is possible to activate the logger from the bar by activating the flag 'bar.debug'. Then you have to reload the page.

flag(bar.debug, true)

Development mode

  • Then, follow these steps:

$ yarn link // in cozy-bar

$ rlink cozy-bar // in the cozy-app

$ yarn start // in cozy-bar

$ yarn start // in the cozy-app

Contribute

If you want to work on cozy-bar itself and submit code modifications, feel free to open pull-requests! See the contributing guide for more information about this repository structure, testing, linting and how to properly open pull-requests.

Community

Localization

Localization and translations are handled by [Transifex][tx], which is used by all Cozy's apps.

As a translator, you can login to [Transifex][tx-signin] (using your Github account) and claim an access to the [app repository][tx-app]. Locales are pulled when app is build before publishing.

As a developer, you just have to modify json in /src/locales. New locales will be automatically added to Transifex. If you need to pull or push manually locales, you can use Transifex CLI. If you were using a transifex-client, you must move to Transifex CLI to be compatible with the v3 API.

Get in touch

You can reach the Cozy Community by:

Licence

cozy-bar is developed by Cozy Cloud and distributed under the MIT.

cozy-bar's People

Contributors

acezard avatar cballevre avatar cedricmessiant avatar clochix avatar cpatchane avatar crash-- avatar dependabot[bot] avatar doubleface avatar edas avatar enguerran avatar goldoraf avatar gooz avatar gregorylegarec avatar jf-cozy avatar kosssi avatar lespacedunmatin avatar m4dz avatar merkur39 avatar narkfr avatar nono avatar pierrevdk avatar probot-auto-merge[bot] avatar ptbrowne avatar renovate-bot avatar renovate[bot] avatar sblaisot avatar sizvix avatar trollepierre avatar y-lohse avatar zatteo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cozy-bar's Issues

Can't disconnect on mobile browsers

The drawer menu needs a safe space so the user can click on the last item of the menu, the disconnect button in our case, especially on iPhone X but any mobile when minimal UI is triggered too.

On minimal UI, the Disconnect button is in the safe area therefore it's not clickable:

screenshot 2018-08-06 14 20 29

And when minimal UI is not triggered, the button is hidden underneath the Safari UI therefore it's not clickable either.

screenshot 2018-08-06 14 20 07

Dependency deprecation warning: travis-deploy-once (npm)

On registry https://registry.npmjs.org/, the "latest" version (v5.0.11) of dependency travis-deploy-once has the following deprecation notice:

We recommend to use Travis Build Stages instead

Marking the latest version of an npm package as deprecated results in the entire package being considered deprecated, so contact the package author you think this is a mistake.

Affected package file(s): package.json

If you don't care about this, you can close this issue and not be warned about travis-deploy-once's deprecation again. If you would like to completely disable all future deprecation warnings then add the following to your config:

"suppressNotifications": ["deprecationWarningIssues"]

Cozy Bar v6 : replaceTitleOnMobile

It seems that replaceTitleOnMobile is not used anymore (at least in a useful way) since

is ow hidding itself. We can remove this ligne
replaceTitleOnMobile ? ' coz-bar-hide-sm' : ''

Also, I expect that, even if I have a responsive view, my App name should be displayed at the top left of the bar (just next to the hamburger menu).

AppIcon should not have a color ?

Je pense que c'est problématique d'avoir les SVG avec de la couleur on devrait pouvoir avoir la même SVG pour les 2 themes. Mais c'est à voir dans de l'optimisation dans un futur plus ou moins proche...

From kosssi : #451 (comment)

BarRight / Left / Center and Context Provider

In a few applications, at least for Drive, we have to do stuff like this :

import BarContextProvider from 'cozy-ui/transpiled/react/BarContextProvider'
{isMobile ? (
        <BarRight>
          <BarContextProvider client={client} t={t} store={client.store}>
            {MoreMenu}
          </BarContextProvider>
        </BarRight>
)

As mentioned by @ptbrowne here (https://github.com/cozy/cozy-drive/pull/2003/files#r414522850) it could be great if those components handle the context by itself.

Is there any use of the cozy-bar without using the context of the requesting App? Or do we have to pass every time the calling app context?

Rendre paramètrable les appels au contexte du cozy

Je vois depuis longtemps à chaque démarrage de l'application mobile des 404:

capture d ecran 2017-11-29 a 18 39 08

Voici les 3 warnings:

Cozy-bar cannot fetch Claudy: The ressource was not found
Cozy-bar cannot fetch comming soon apps: The ressource was not found
Cannot get Cozy help link

Pourrait on limiter ses requêtes (on stock le résultat) ? et/ou pouvoir les désactiver si les services derrières ne sont pas disponible dans une app mobile ?

Padding right 1em is normal ?

I see a right padding in the bar and it makes the BarRight component 1em to the right. Is it an expected behavior ?

See my screenshot below :

image

CozyBar & reactIs.isMemo ?

I have this error on drive when linking the current master. I don't know why (yet)

Uncaught (in promise) TypeError: ReactIs.isMemo is not a function
    at getStatics (cozy-bar.js:29921)
    at hoistNonReactStatics (cozy-bar.js:29951)
    at hoistNonReactStatics (cozy-bar.js:29941)
    at wrapWithConnect (cozy-bar.js:70233)
    at Object../src/components/Apps/AppsContent.jsx (cozy-bar.js:77785)
    at __webpack_require__ (cozy-bar.js:30)
    at Object../src/components/Drawer.jsx (cozy-bar.js:78592)
    at __webpack_require__ (cozy-bar.js:30)
    at Object../src/components/Bar.jsx (cozy-bar.js:78108)
    at __webpack_require__ (cozy-bar.js:30)
    at injectBarInDOM (cozy-bar.js:79946)
    at Object._callee$ (cozy-bar.js:80157)
    at tryCatch (cozy-bar.js:72898)
    at Generator.invoke [as _invoke] (cozy-bar.js:73132)
    at Generator.prototype.(:8080/anonymous function) [as next] (http://drive.cozy.tools:8080/public/cozy-bar.js:72950:21)
    at asyncGeneratorStep (cozy-bar.js:79911)
    at _next (cozy-bar.js:79913)
    at cozy-bar.js:79913
    at new Promise (<anonymous>)
    at Object.<anonymous> (cozy-bar.js:79913)
    at Object.init (cozy-bar.js:80179)
    at initCozyBar (index.jsx:27)
    at _callee$ (index.jsx:83)
    at tryCatch (runtime.js:62)
    at Generator.invoke [as _invoke] (runtime.js:288)
    at Generator.prototype.(:8080/anonymous function) [as next] (http://drive.cozy.tools:8080/public/drive.js:139467:21)
    at asyncGeneratorStep (es6.reflect.get-prototype-of.js:10)
    at _next (es6.reflect.get-prototype-of.js:10)

Rendre la cozy-bar offline compatible

Pour les applications mobiles nous avons besoins que la cozy-bar puisse s'initialiser correctement sans avoir besoin du réseau.

Voici les différentes tâches que je vais faire pour résoudre ce soucis:

  • Persister le store Redux grâce à localForage
  • Charger le store persisté et l'injecter

Voici les refactos que je pense faire:

  • Création d'un dossier src/lib/store avec 2 fichiers index.js et persistedState.js
  • Création d'un dossier src/lib/reducers avec l'ensemble des reducers.
  • Supprimer l'appel à getDefaultLocale dans src/index.jsx puisque c'est le reducer Locale qui le fait directement.

Si vous avez des suggestions, des questions, n'hésitez pas.

NB: Je pensais rendre le store asynchrone comme sur les apps mais finalement ça pose des soucis donc je vais créer le store puis charger le store persisté dans un second temps.

Settings app url is not updated on logout/login

On the banks cordova app, we have the following problem with the bar:

  • Login on an instance A
  • Open the drawer, then click on "Settings"
  • I am redirected to A-settings.mycozy.cloud in my browser
  • Logout
  • Login on an instance B
  • Open the drawer, then click on "Settings"
  • I am redirected to A-settings.mycozy.cloud instead of B-settings.mycozy.cloud in my browser

Il ne faut pas utiliser `window.location` sur des fonctionnalités pour app mobile

Avec cette recherche on s’aperçoit qu'il y a plusieurs occurrences dans la cozy-bar de window.location.

Ce n'est pas possible sur les applications mobile puisque nous avons ce type d'url file:///var/containers/Bundle/Application/F1E62264-09DD-4A2B-B3AD-4DFA1C4EEB8C/Cozy%20Banks.app/www/index.html#/balances.
Lorsque l'on passe cozyUrl à la bar nous passons donc le protocole ainsi que le domain : https://mon.fake.cozy

Problème de token

Sur mobile lorsque l'on passe un token à la bar, si le token n'est pas le bon alors la cozy-bar ne notifie pas l'application qu'elle doit lui fournir un nouveau token. Ce qui pose des soucis pour l'affichage des icones.

Nous pourrions imaginer que lorsque l'on initialise la cozy-bar nous lui passions une fonction shouldUpdateToken qui serait appelée dès que la cozy-bar intercepte une 409 de la stack.

Le souci est actuellement sur cozy-banks parce qu'on ne fournissait pas correctement le refreshToken mais il peut apparaitre sur tous les cozy lorsque le token expire et que l'on ouvre le menu avant que l'app ne fasse d'appel (on est d'accord que les cas doivent être rare mais faisable).

Vous en pensez quoi ?

Have the application list available in offline mode

Inside mobile apps, we want the cozy-bar to display the apps list even if we are offline (after a frist successful fetch).

My idea was to automatically save the apps slice inside localStorage and retrieve it afterwards.

The AppsList is also conditionally rendered if apps list is fetching.

{isAppListFetching
? (
<Spinner size='xlarge' middle />
)
: (
<AppsList
wrappingLimit={3}
renewToken={renewToken}
toggleComingSoon={toggleComingSoon}
/>
)
}

I think this should be changed to whether the apps have been loaded once.

Disconnection should remove data from the localStorage

Cozy Bar Title 🤔

After renaming Cozy Files to Cozy Drive, I see on the 'manifest.webapp', the name have not Cozy word:

"name": "Drive",

I change it to Cozy Drive but after this, when I start Cozy Drive app I see 'cozy cozy drive' on title.

I propose 2 changes:

  • Remove the cozy word here
  • Remove the lowercase here

What do you think ?

babel-polyfill ?

Hi, I found a problem and I think the fix should be in cozy-bar, but let's discuss this.

The problem

On browsers that don't support Object.assign (which includes IE11, which we support), some apps crash with the error Object doesn't support property or method 'assign'.
More specifically, this error is emitted by the cozy-bar, when it imports the Modal component from cozy-ui which uses Object.assign right away.

the solution

We really want to polyfill Object.assign, and in fact, we mostly do. Our apps don't have this problem. But cozy-bar doesn't polyfill it, and I really think it should.
To be clearer, cozy-bar uses the cozy-app babel preset, which replaces it's own Object.assign calls, but does not polyfill Object.assign. So when cozy-ui tries to use it it crashes. We're supposed to import 'babel-polyfill' at the very begining of the app for that.

The alternative

Noticed that I said only some apps crash? A couple aren't affected, because they load the app's code (including the polyfill) before they load cozy-bar.js. They tend to use this form of templating.
So we could also switch all apps to this format.


If we import babel-polyfill in cozy-bar, we'll essentially load it twice on each page — once in the app and once in the bar. Which makes sense because both are standalone files, but it's also annoying.

Personally I think it's better to take the weight hit, and be less fragile. Third party devs won't know they have to provide their own polyfills and might run into the same problem.

Layout breaks on Safari

Due to extra height to [role=application], it forces Safari to scroll the app content when we want full width & height with no scroll.

Screenshot:
Safari scrolling bug

I think the culprit here is the inherit on the height https://github.com/cozy/cozy-bar/blob/master/src/styles/base.css#L12

body's height is 100vh, and we actually don't want that, we want the [role=application] to have a height of 100% of the remaining height which is 100vh minus the height of the cozy-bar.

Problème de CSS en mobile

Nous avons eu un problème sur la dernière publication de l'application mobile cozy/cozy-banks#930

Le design d'un bouton a changé seulement sur l'application mobile. En regardant de plus prêt nous avons un bouton avec 2 classes CSS. Une des classes provient de cozy-ui et la second de notre application. Notre classe est surchargé par la class de cozy-ui puisque la cozy-bar vient avec ce style et doit être chargé après le style de notre application.

Le problème a déjà été rencontré la semaine dernière par l'équipe Gangsters. @y-lohse avait l'air de dire qu'il avait eu le souci aussi.

Nous avons imaginé 3 façons de résoudre le problème:

  • Faire en sorte que l'ordre des CSS / JS soit le même que sur le web
  • Faire le tour de passe myReact / react (que cozy-ui soit importé seulement par l'application, mais ça peut poser un problème si l'app a une version moins récente que cozy-bar)
  • Builder la bar depuis l'app

PS: J'ai crée l'issue pour information et pour répertorier de nouveau le problème si ça arrive. On prendra plus de temps pour essayer de résoudre le souci à ce moment.

Bar[Left | Center | Right] context

The cozy-bar exposes these components though the code located here : https://github.com/cozy/cozy-bar/blob/master/src/lib/api.js#L29

One problem we keep running into is that because the component is rendered in the cozy-bar, it also gets the context of the cozy-bar. Any HOC that relies on the context (like connect or translate) will use the wrong context and usually things break.

I don't know what the solution is, but if anyone has ideas, shoot!


Here's a small example of the problem:

const MyBreakingComponent = translate()(({ t }) => <div>{t('my_app_string')}</div>)

<Main>
  works: <MyBreakingComponent />
  doesn't work: <BarLeft><MyBreakingComponent /></BarLeft>
</Main>

In the second case, t comes from the cozy-var context, so it can provide the translations shipped with the bar, but not with the app.

Ideas for a lighter bar

The bar is fairly big on is included in all our applications. It needs to be shipped in several ways :

  • On mobile it is included in the application
  • On web it is shipped by the stack

The bar depends on several libraries :

  • cozy-client
  • cozy-ui
  • React

Historically, the bar has bundled all its libraries since it is easiest way for it to be served by the stack. It also enables the bar to work everywhere, even in non React contexts.

Unfortunately, we can see (below in the screenshots) that those libraries make up for most of the size of the cozy-bar.

Possible actions

  • a light build could be provided for applications that want to provide big libraries. cozy-ui and other big libs (React, ReactDOM) could be provided by the host application (using webpack externals).
    {{ STACK_ASSETS_LIGHT }} could be used in the template to indicate to the stack that we want smaller libs.

  • The bar could be shipped on npm only transpiled to be bundled in the application later (it would also be good for the mobile usage)

  • hammerjs could be replaced by something lighter since we use it only at one place, it seems likely that we are not using all its functionalities (= remove big libraries when they are used only once)

  • The bar could be a React component, inheriting from the cozyClient in the context

Output of webpack-analyzer

image

Discussion with Cedric on Mattermost

patrick
a mon avis, cozy-bar devrait recevoir cozy-ui, preact etc..
(édité)
cedric:
11:01 AM
aaah oui ça va être chiant pour la personalisation ça tiens
que cozy-bar utilise son propre cozy-ui ><
hum peut être quelque chose à faire avec les chunks ici
patrick:
11:04 AM
je ne crois pas
si l application hote a deja cozy-ui et preact, il ne faut pas que la cozy-bar le shippe
c est surtout ca le probleme je pense
cedric:
11:05 AM
Si tu le shippe pas, il saura le retrouver tout seul avec l'app?
patrick:
11:06 AM
tu lui passe une reference de React/ReactDOM/CozyUI
cedric:
11:06 AM
Le truc c'est que la bar est aussi prévu pour savoir fonctionner seul, une app vailla ou vuejs doit être capable de l'utiliser
ou bien on fait des build différents
patrick:
11:06 AM
dans ce cas la tu prends un build qui contient tout
cedric:
11:06 AM
bundle et léger
A tester alors, là je t'avouerai que je ne pourrais pas regarder ça avant mes vacances
patrick:
11:07 AM
cozy-ui ne devrait pas etre completement integré je pense
j ai l impression que ds ce cas on devrait utiliser des chemins complets
cedric:
11:07 AM
Il n'est pas completement intégré, c'est juste les icones qui prennet pas mal de place en fait
patrick:
11:08 AM
il faut que j etudie pourquoi le tree shaking ne marhce pas
cedric:
11:08 AM
c'est pas ce qui est fait dans la bar?
le tree shaking ne fonctionne pas bien avec webpack 3, webpack 4 pourrait faire mieux
patrick:
11:08 AM
Image collée à 2018-8-7 11-08.png
ya la modal et tout
cedric:
11:08 AM
Parce que la bar utilise la modale aussi
le tracker aussi
je n'utilise jamais index de cozy-ui pour éviter de tout prendre justement, après j'ai peut être raté un truc
patrick:
11:12 AM
ok
j allais te demander comment on fait pour le bundlesize sur ma PR
(édité)
je vois que cozy-bar est deja en rouge en fait
tiens en decembre 2017 j'avais ouvert #146
cedric:
11:16 AM
bundlesize n'est vraiment pas bloquant c'est vraiement pour nous pour garder en tête
ah oui tiens, la bar n'avançant vraiment pas beaucoup en ce moment, je fais vraiment pas souvent le tour des issues, je l'ai vu mais ça restait pas urgent

Properly unmount the bar on mobile app

On Banks' mobile app, when the user logouts, we have to destroy the cozy-bar. Today, we are doing it by removing the DOM node (https://github.com/cozy/cozy-banks/blob/b794e588cbac644a3275ab28ef92f6ef13eb541b/src/ducks/mobile/utils.js#L12). But since the bar is adding some styles on the body when it's opened, we had to also remove these styles (https://github.com/cozy/cozy-banks/blob/b794e588cbac644a3275ab28ef92f6ef13eb541b/src/ducks/mobile/utils.js#L13).

It seems we should expose an API to just ask to unmount the cozy-bar (like destroy, unmount, whatever) so all these things could be managed properly by the bar. What do you think?

Why harvest is a `dep`?

We're trying to figure out some CSS issues on our side and I just saw that harvest is delivered as a dep in the bar. But we don't use it... ?

What is the reason for that?

BarLeft, contexts and stores

Since we render <BarLeft />, <BarRight /> inside the context of the bar, their context is changed and as such, some components using the redux store, will get the store of the bar instead of the one of their app. We can use a trick and essentially bind the context to the component but I think it should be easier to do than that. I suggest to use a different storeKey for the bar store : https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm @babel/polyfill Unavailable
npm npm-run-all Available

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): update dependency @testing-library/react to ^10.4.7
  • fix(deps): update dependency react-redux to v5.1.2
  • fix(deps): update dependency cozy-device-helper to v2.7.0
  • fix(deps): update dependency cozy-flags to v2.12.0
  • fix(deps): update dependency cozy-intent to v1.17.3
  • fix(deps): update dependency cozy-interapp to v0.9.0
  • fix(deps): update dependency cozy-logger to v1.10.4
  • fix(deps): update dependency cozy-realtime to v4.6.0
  • fix(deps): update dependency cozy-ui to v103.12.0
  • fix(deps): update dependency eslint-config-cozy-app to v2.1.1
  • fix(deps): update dependency prop-types to v15.8.1
  • fix(deps): update dependency redux to v4.2.1
  • fix(deps): update dependency redux-thunk to v2.4.2
  • fix(deps): update dependency stylus to v0.63.0
  • fix(deps): update dependency @testing-library/react to v16
  • fix(deps): update dependency babel-loader to v9
  • fix(deps): update dependency babel-plugin-module-resolver to v5
  • fix(deps): update dependency babel-preset-cozy-app to v2
  • fix(deps): update dependency cozy-client to v48
  • fix(deps): update dependency cozy-device-helper to v3
  • fix(deps): update dependency cozy-flags to v3
  • fix(deps): update dependency cozy-intent to v2
  • fix(deps): update dependency cozy-realtime to v5
  • fix(deps): update dependency cozy-ui to v110
  • fix(deps): update dependency eslint-config-cozy-app to v6
  • fix(deps): update dependency node to v20
  • fix(deps): update dependency react-redux to v9
  • fix(deps): update dependency redux to v5
  • fix(deps): update dependency redux-persist to v6
  • fix(deps): update dependency redux-thunk to v3
  • fix(deps): update react monorepo to v18 (major) (react, react-dom)
  • 🔐 Create all rate-limited PRs at once 🔐

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

  • fix(deps): pin dependencies (@babel/polyfill, @cozy/minilog, @testing-library/jest-dom, @testing-library/react, babel-loader, babel-plugin-css-modules-transform, babel-plugin-inline-json-import, babel-plugin-module-resolver, babel-plugin-transform-define, babel-preset-cozy-app, enzyme-adapter-react-16, lodash.set, node, react, react-dom)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • hammerjs 2.0.8
  • lodash.debounce 4.0.8
  • lodash.set ^4.3.2
  • lodash.unionwith 4.6.0
  • prop-types 15.7.2
  • react-redux 5.1.1
  • redux 4.1.2
  • redux-logger 3.0.6
  • redux-persist 5.10.0
  • redux-thunk 2.3.0
  • @babel/cli 7.12.1
  • @babel/core 7.6.2
  • @babel/polyfill ^7.10.4
  • @cozy/minilog ^1.0.0
  • @testing-library/jest-dom ^6.2.0
  • @testing-library/react ^10.2.1
  • babel-jest 24.9.0
  • babel-loader ^8.1.0
  • babel-plugin-css-modules-transform ^1.6.2
  • babel-plugin-inline-json-import ^0.3.2
  • babel-plugin-module-resolver ^4.0.0
  • babel-plugin-transform-define ^2.0.0
  • babel-preset-cozy-app ^1.9.0
  • cozy-client ^45.13.0
  • cozy-device-helper 2.6.0
  • cozy-flags ^2.10.2
  • cozy-intent ^1.7.0
  • cozy-interapp 0.4.9
  • cozy-logger 1.9.1
  • cozy-realtime ^4.0.5
  • cozy-ui 103.7.0
  • enzyme 3.10.0
  • enzyme-adapter-react-16 1.3
  • enzyme-to-json 3.3.5
  • eslint-config-cozy-app 2.0.0
  • identity-obj-proxy 3.0.0
  • jest 24.9.0
  • npm-run-all 4.1.5
  • react 16.10.1
  • react-dom 16.10.1
  • semantic-release 15.13.24
  • stylus 0.57.0
  • @cozy/minilog >=1.0.0
  • cozy-client >=45.13.0
  • cozy-device-helper >=2.6.0
  • cozy-flags >=2.10.2
  • cozy-interapp >=0.4.9
  • cozy-realtime >=4.0.5
  • cozy-ui >=103.7.0
  • cozy-intent >=1.3.0
  • react >=16.10.1
  • react-dom >=16.10.1
nvm
.nvmrc
  • node 16

  • Check this box to trigger a request for Renovate to run again on this repository

Remove default value from DOM

We now have a new method to init and inject the cozy-stack variables in the app's dom. We use cozy-data={{}} instead of cozy-data-X={}. By doing so, we can break the bar if the app doesn't pass all the value during the initialization phase of the bar.

I think we should remove the fact that the Bar can init itself from the DOM. The APP should be responsible to do that.

We should remove https://github.com/cozy/cozy-bar/blob/master/src/dom.js#L4 for instance.

appNamePrefix = getAppNamePrefix(),
we should not set default value.

(see cozy/cozy-drive#2395)

Cozybar on public page

Since we inject a CozyClient from the app to the bar, if we inject a non identified client (from a public view for instance) , we got an uncaught error :

Uncaught Error: The application can't subscribe to io.cozy.apps
    at WebSocket.onSocketMessage (cozy-bar.js:17464)

This error is only blocking in our end to end test since every non catched error generate a real error.

We currently fixed the error by removing the injection of cozyclient (tmp fix cozy/cozy-drive#1530)

Imported components from cozy-ui

When using components imported from cozy-ui (such as Button), their styles are not loaded — at least in dev mode. I suspect it's because cozy-ui uses stylus files and there's no webpack loader configured for that in the cozy-bar.

Edit: rectification: there is a config for stylus files for react, but it doesn't appear to be working as intended.

Stop using appEditor from `manifest.editor`

Since the editor field in the manifest file (see in collect) will match the editor used to publish an application in the registry, the way we use it from now in the cozy-bar is wrong (it begins to be complicated to not be confusing in the cozy-store). For the bar we just need a prefix to display near the application name (which can be the same as the editor). So I suggest to add a field in the manifest file dedicated to this usage which can be something like app_prefix. It's clear and more meaningful IMHO.
What do you think?

For more context, here is how the bar get this prefix from now (https://github.com/cozy/cozy-bar/blob/master/src/index.jsx#L106):

appNode.dataset.cozyAppEditor || appNode.dataset.cozyEditor || undefined

Meaning these HTML attributes fulfilled by the stack in our HTML main file:

<div
  role="application"
  ...
  data-cozy-editor="{{.AppEditor}}"
  ## OR ##
  data-cozy-app-editor="{{.AppEditor}}"
  ...
/>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.