Skip to content

Commit

Permalink
feat: Remove Claudy
Browse files Browse the repository at this point in the history
The floating Claudy button creates problems to access the action below it so that’s why we remove it for the moment
  • Loading branch information
cballevre committed Aug 24, 2023
1 parent d460806 commit c7a606e
Show file tree
Hide file tree
Showing 29 changed files with 2 additions and 399 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ Coming Soon application
---
Coming Soon applications (or apps) are defined in your Cozy's [configuration file](https://github.com/cozy/cozy-stack/blob/master/docs/config.md#main-configuration-file). See the `cozy.example.yaml` file [provided by the stack](https://github.com/cozy/cozy-stack/blob/master/cozy.example.yaml#L80).

Claudy actions list
---
Claudy actions are declared in `src/config/claudy.yaml` with a slug as property name and some options (icon name and link options for example). The slugs list that will be used for Claudy is defined in your Cozy's [configuration file](https://github.com/cozy/cozy-stack/blob/master/docs/config.md#main-configuration-file). See the `cozy.example.yaml` file [provided by the stack](https://github.com/cozy/cozy-stack/blob/master/cozy.example.yaml#L101).
If no `claudy_actions` property is defined in the configuration, Claudy won't be displayed.

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.
Expand Down
5 changes: 0 additions & 5 deletions src/assets/icons/16/icon-claudy.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/assets/icons/32/icon-claudy.svg

This file was deleted.

6 changes: 0 additions & 6 deletions src/assets/icons/claudyActions/icon-bills.svg

This file was deleted.

7 changes: 0 additions & 7 deletions src/assets/icons/claudyActions/icon-laptop.svg

This file was deleted.

8 changes: 0 additions & 8 deletions src/assets/icons/claudyActions/icon-phone.svg

This file was deleted.

6 changes: 0 additions & 6 deletions src/assets/icons/claudyActions/icon-question-mark.svg

This file was deleted.

38 changes: 1 addition & 37 deletions src/components/Bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Drawer from 'components/Drawer'
import Settings from 'components/Settings'
import Apps from 'components/Apps'
import SearchBar from 'components/SearchBar'
import Claudy from 'components/Claudy'
import {
getTheme,
hasFetched,
Expand All @@ -22,7 +21,6 @@ import {
fetchApps,
fetchContext,
fetchSettingsData,
shouldEnableClaudy,
getWebviewContext
} from 'lib/reducers'

Expand All @@ -32,8 +30,6 @@ export class Bar extends Component {
constructor(props) {
super(props)
this.state = {
claudyFired: false, // true to fire claudy (used by the drawer)
claudyOpened: false,
drawerVisible: false,
searchBarEnabled:
props.isDrive && !props.isPublic && !isMobileApp() && !isFlagshipApp()
Expand Down Expand Up @@ -83,26 +79,12 @@ export class Bar extends Component {
}

toggleDrawer = () => {
// don't allow to toggle the drawer if claudy opened or is opening
if (this.state.claudyOpened || this.state.claudyFired) return
const drawerVisible = !this.state.drawerVisible
// don't wait for transitionend if displaying
if (drawerVisible) this.props.onDrawer(drawerVisible)
this.setState({ drawerVisible })
}

toggleClaudy = (isFromDrawer = false) => {
if (!this.props.claudyEnabled) return
const { claudyOpened } = this.state
if (isFromDrawer && !claudyOpened) {
// if opened from drawer
// reset to toggle via the Claudy component
return this.setState({ claudyFired: true })
}
if (this.state.claudyFired) this.setState({ claudyFired: false })
this.setState({ claudyOpened: !claudyOpened })
}

renderCenter() {
const {
appName,
Expand Down Expand Up @@ -158,12 +140,7 @@ export class Bar extends Component {
}

render() {
const {
claudyFired,
claudyOpened,
drawerVisible,
searchBarEnabled
} = this.state
const { drawerVisible, searchBarEnabled } = this.state

const {
theme,
Expand All @@ -172,7 +149,6 @@ export class Bar extends Component {
barRight,
barCenter,
barSearch,
claudyEnabled,
onDrawer,
isPublic,
onLogOut,
Expand Down Expand Up @@ -207,22 +183,11 @@ export class Bar extends Component {
<Drawer
visible={drawerVisible}
onClose={this.toggleDrawer}
onClaudy={
(claudyEnabled && (() => this.toggleClaudy(true))) || false
}
isClaudyLoading={claudyFired}
drawerListener={() => onDrawer(drawerVisible)}
onLogOut={onLogOut}
isInvertedTheme={isInvertedTheme}
/>
) : null}
{claudyEnabled && (
<Claudy
claudyFired={claudyFired}
onToggle={() => this.toggleClaudy(false)}
opened={claudyOpened}
/>
)}
</div>
{userActionRequired && <Banner {...userActionRequired} />}
</div>
Expand Down Expand Up @@ -254,7 +219,6 @@ export const mapStateToProps = state => ({
barCenter: getContent(state, 'center'),
barSearch: getContent(state, 'search'),
isDrive: isCurrentApp(state, { slug: 'drive' }),
claudyEnabled: shouldEnableClaudy(state),
hasFetchedApps: hasFetched(state),
webviewContext: getWebviewContext(state)
})
Expand Down
81 changes: 0 additions & 81 deletions src/components/Claudy.jsx

This file was deleted.

13 changes: 1 addition & 12 deletions src/components/Drawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,7 @@ class Drawer extends Component {
}

render() {
const {
onClaudy,
visible,
isClaudyLoading,
settingsAppURL,
storageData,
isInvertedTheme
} = this.props
const { visible, settingsAppURL, storageData, isInvertedTheme } = this.props
const tabIndex = visible ? 0 : -1
return (
<div
Expand Down Expand Up @@ -203,8 +196,6 @@ class Drawer extends Component {
onLogOut={this.handleLogout}
storageData={storageData}
settingsAppURL={settingsAppURL}
isClaudyLoading={isClaudyLoading}
onClaudy={onClaudy}
tabIndex={tabIndex}
isDrawer
/>
Expand All @@ -219,8 +210,6 @@ Drawer.propTypes = {
visible: PropTypes.bool,
onClose: PropTypes.func,
onLogOut: PropTypes.func,
onClaudy: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
isClaudyLoading: PropTypes.bool,
isInvertedTheme: PropTypes.bool,
storageData: PropTypes.object,
settingsAppURL: PropTypes.string,
Expand Down
23 changes: 0 additions & 23 deletions src/components/Settings/SettingsContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'

import flag from 'cozy-flags'
import { translate } from 'cozy-ui/react/I18n'
import { Button } from 'cozy-ui/react/Button'
import { isMobileApp } from 'cozy-device-helper'
import StorageData from 'components/Settings/StorageData'

Expand All @@ -12,9 +11,7 @@ const SettingsContent = ({
onLogOut,
settingsAppURL,
storageData,
onClaudy,
isDrawer = false,
isClaudyLoading,
shoulDisplayViewOfferButton,
managerUrlPremiumLink,
tabIndex,
Expand Down Expand Up @@ -122,24 +119,6 @@ const SettingsContent = ({
</ul>
</>
)}
{isDrawer && onClaudy && !isMobileApp() && (
<ul className="coz-nav-group">
<li className="coz-nav-settings-item">
<Button
type="button"
role="menuitem"
className="coz-nav-settings-item-btn"
icon="cloud"
busy={isClaudyLoading}
onClick={onClaudy}
title={t('claudy.title')}
label={t('claudy.title')}
tabIndex={tabIndex}
aria-hidden={ariaHidden}
/>
</li>
</ul>
)}
<ul className="coz-nav-group">
{!isMobileApp() && (
<>
Expand Down Expand Up @@ -203,9 +182,7 @@ SettingsContent.propTypes = {
onLogOut: PropTypes.func.isRequired,
settingsAppURL: PropTypes.string,
storageData: PropTypes.object,
onClaudy: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
isDrawer: PropTypes.bool,
isClaudyLoading: PropTypes.bool,
tabIndex: PropTypes.number,
ariaHidden: PropTypes.bool
}
Expand Down
11 changes: 0 additions & 11 deletions src/components/__snapshots__/Bar.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ exports[`Bar should change allow theme overrides 1`] = `
<Wrapper />
<Connect(Drawer)
drawerListener={[Function]}
isClaudyLoading={false}
onClaudy={false}
onClose={[Function]}
visible={false}
/>
Expand Down Expand Up @@ -87,8 +85,6 @@ exports[`Bar should change theme 1`] = `
<Wrapper />
<Connect(Drawer)
drawerListener={[Function]}
isClaudyLoading={false}
onClaudy={false}
onClose={[Function]}
visible={false}
/>
Expand Down Expand Up @@ -143,8 +139,6 @@ exports[`Bar should display the Searchbar 1`] = `
<Wrapper />
<Connect(Drawer)
drawerListener={[Function]}
isClaudyLoading={false}
onClaudy={false}
onClose={[Function]}
visible={false}
/>
Expand All @@ -166,7 +160,6 @@ Object {
"barLeft": undefined,
"barRight": undefined,
"barSearch": undefined,
"claudyEnabled": false,
"hasFetchedApps": false,
"isDrive": false,
"theme": "default",
Expand Down Expand Up @@ -235,8 +228,6 @@ exports[`Bar should not display searchbar if we are not on Cozy Drive 1`] = `
<Wrapper />
<Connect(Drawer)
drawerListener={[Function]}
isClaudyLoading={false}
onClaudy={false}
onClose={[Function]}
visible={false}
/>
Expand Down Expand Up @@ -283,8 +274,6 @@ exports[`Bar should not display searchbar if we are on mobile 1`] = `
<Wrapper />
<Connect(Drawer)
drawerListener={[Function]}
isClaudyLoading={false}
onClaudy={false}
onClose={[Function]}
visible={false}
/>
Expand Down
14 changes: 0 additions & 14 deletions src/config/claudyActions.yaml

This file was deleted.

Loading

0 comments on commit c7a606e

Please sign in to comment.