Unverified Commit b67a9116 authored by Marcos Iglesias's avatar Marcos Iglesias Committed by GitHub

removed preferences page, not used qanywhere (#803)

Signed-off-by: 's avatarMarcos Iglesias <miglesiasvalle@lyft.com>
parent bb7b69a8
// Copyright Contributors to the Amundsen project.
// SPDX-License-Identifier: Apache-2.0
import * as React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
export type PreferenceGroupProps = {
onClick: (value: string) => any;
preferenceValue: string;
selected: boolean;
title: string;
subtitle: string;
};
export class PreferenceGroup extends React.Component<PreferenceGroupProps> {
public static defaultProps: Partial<PreferenceGroupProps> = {
selected: false,
title: '',
subtitle: '',
};
onClick = () => {
this.props.onClick(this.props.preferenceValue);
};
// TODO: Consolidate with future common RadioButton component.
render() {
return (
<label className="preference-group" onClick={this.onClick}>
<input
defaultChecked={this.props.selected}
type="radio"
className="preference-radio"
name="notification-preference"
/>
<div className="preference-text">
<div className="title-2">{this.props.title}</div>
<div className="body-secondary-3">{this.props.subtitle}</div>
</div>
</label>
);
}
}
export default PreferenceGroup;
/* TODO: harcoded string that should be translatable/customizable */
export const NOTIFICATION_PREFERENCES_TITLE = 'Notification Preferences';
export const ALL_NOTIFICATIONS_TITLE = 'All Notifications';
export const ALL_NOTIFICATIONS_SUBTITLE =
'You will get notified via email regarding any activity on tables you own.';
export const MINIMUM_NOTIFICATIONS_TITLE = 'Minimum Notifications Only';
export const MINIMUM_NOTIFICATIONS_SUBTITLE =
"You will only be notified when you're being added as an owner, removed as an owner, or receive a description request on any table you own.";
export const ALL_PREFERENCE = 'all-preference';
export const MINIMUM_PREFERENCE = 'minimum-preference';
// Copyright Contributors to the Amundsen project.
// SPDX-License-Identifier: Apache-2.0
import * as React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { PreferenceGroup } from './PreferenceGroup';
// TODO: Use css-modules instead of 'import'
import './styles.scss';
import {
ALL_NOTIFICATIONS_SUBTITLE,
ALL_NOTIFICATIONS_TITLE,
ALL_PREFERENCE,
MINIMUM_NOTIFICATIONS_SUBTITLE,
MINIMUM_NOTIFICATIONS_TITLE,
MINIMUM_PREFERENCE,
NOTIFICATION_PREFERENCES_TITLE,
} from './constants';
// TODO: Implement tests before component is exposed
interface PreferencesPageState {
selectedPreference: string;
}
export interface DispatchFromProps {}
export type PreferencesPageProps = DispatchFromProps;
export class PreferencesPage extends React.Component<
PreferencesPageProps,
PreferencesPageState
> {
constructor(props) {
super(props);
this.changePreference = this.changePreference.bind(this);
this.state = {
selectedPreference: ALL_PREFERENCE,
};
}
changePreference = (newPreference) => {
this.setState({
selectedPreference: newPreference,
});
};
render() {
return (
<div className="container">
<div className="row">
<div className="col-xs-12 col-md-offset-1 col-md-10">
<h1 className="preferences-title">
{NOTIFICATION_PREFERENCES_TITLE}
</h1>
<PreferenceGroup
onClick={this.changePreference}
preferenceValue={ALL_PREFERENCE}
selected={this.state.selectedPreference === ALL_PREFERENCE}
title={ALL_NOTIFICATIONS_TITLE}
subtitle={ALL_NOTIFICATIONS_SUBTITLE}
/>
<PreferenceGroup
onClick={this.changePreference}
preferenceValue={MINIMUM_PREFERENCE}
selected={this.state.selectedPreference === MINIMUM_PREFERENCE}
title={MINIMUM_NOTIFICATIONS_TITLE}
subtitle={MINIMUM_NOTIFICATIONS_SUBTITLE}
/>
</div>
</div>
</div>
);
}
}
export const mapDispatchToProps = (dispatch: any) => {
return bindActionCreators({}, dispatch);
};
export default connect<DispatchFromProps>(
null,
mapDispatchToProps
)(PreferencesPage);
// Copyright Contributors to the Amundsen project.
// SPDX-License-Identifier: Apache-2.0
@import 'variables';
.preferences-title {
margin-bottom: 72px;
}
.preference-group {
display: flex;
margin-bottom: 32px;
}
.preference-text {
margin-left: 16px;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment