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 e55ae9f commit 8eb1d93
Show file tree
Hide file tree
Showing 29 changed files with 3 additions and 398 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ Help link is defined in your Cozy's [configuration file](https://github.com/cozy

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
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.

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

Expand All @@ -41,8 +39,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
}
this.fetchApps = this.fetchApps.bind(this)
Expand Down Expand Up @@ -90,26 +86,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 @@ -163,7 +145,7 @@ export class Bar extends Component {
}

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

const {
theme,
Expand All @@ -172,7 +154,6 @@ export class Bar extends Component {
barRight,
barCenter,
barSearch,
claudyEnabled,
onDrawer,
isPublic,
onLogOut,
Expand Down Expand Up @@ -202,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 @@ -247,7 +217,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
83 changes: 0 additions & 83 deletions src/components/Claudy.jsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/components/ClaudyIcon.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 @@ -163,14 +163,7 @@ class Drawer extends Component {
}

render() {
const {
onClaudy,
visible,
isClaudyLoading,
settingsAppURL,
storageData,
isInvertedTheme
} = this.props
const { visible, settingsAppURL, storageData, isInvertedTheme } = this.props
return (
<div
className="coz-drawer-wrapper"
Expand All @@ -197,8 +190,6 @@ class Drawer extends Component {
onLogOut={this.handleLogout}
storageData={storageData}
settingsAppURL={settingsAppURL}
isClaudyLoading={isClaudyLoading}
onClaudy={onClaudy}
isDrawer
/>
</nav>
Expand All @@ -212,8 +203,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
22 changes: 1 addition & 21 deletions src/components/Settings/SettingsContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { isMobileApp } from 'cozy-device-helper'
import { translate } from 'cozy-ui/transpiled/react/I18n'
import Icon from 'cozy-ui/transpiled/react/Icon'
import OpenwithIcon from 'cozy-ui/transpiled/react/Icons/Openwith'
import CloudIcon from 'cozy-ui/transpiled/react/Icons/Cloud'
import PeopleIcon from 'cozy-ui/transpiled/react/Icons/People'
import GraphCircleIcon from 'cozy-ui/transpiled/react/Icons/GraphCircle'
import CozyCircleIcon from 'cozy-ui/transpiled/react/Icons/CozyCircle'
Expand Down Expand Up @@ -47,9 +46,7 @@ const SettingsContent = ({
onLogOut,
settingsAppURL,
storageData,
onClaudy,
isDrawer = false,
isClaudyLoading,
shoulDisplayViewOfferButton,
managerUrlPremiumLink
}) => (
Expand Down Expand Up @@ -135,21 +132,6 @@ const SettingsContent = ({
</a>
</NavItem>
</NavGroup>
{isDrawer && onClaudy && !isMobileApp() && (
<NavGroup>
<NavItem>
<button
type="button"
role="menuitem"
className="coz-nav-settings-item-btn"
busy={isClaudyLoading}
onClick={onClaudy}
>
<MenuIcon icon={CloudIcon} /> {t('claudy.title')}
</button>
</NavItem>
</NavGroup>
)}
<NavGroup>
{!isMobileApp() && (
<>
Expand Down Expand Up @@ -203,8 +185,6 @@ 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
isDrawer: PropTypes.bool
}
export default translate()(SettingsContent)
5 changes: 0 additions & 5 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`] = `
<ForwardRef />
<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`] = `
<ForwardRef />
<Connect(Drawer)
drawerListener={[Function]}
isClaudyLoading={false}
onClaudy={false}
onClose={[Function]}
visible={false}
/>
Expand All @@ -110,7 +106,6 @@ Object {
"barLeft": undefined,
"barRight": undefined,
"barSearch": undefined,
"claudyEnabled": false,
"hasFetchedApps": false,
"isDrive": false,
"theme": "default",
Expand Down
20 changes: 0 additions & 20 deletions src/config/claudyActions.json

This file was deleted.

Loading

0 comments on commit 8eb1d93

Please sign in to comment.