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

Visual warts #25

Open
wants to merge 3 commits into
base: main
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
25 changes: 12 additions & 13 deletions src/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,22 @@ const routes = {
{ title: 'Login', path: '/login', icon: logIn },
{ title: 'Support', path: '/support', icon: help },
{ title: 'Signup', path: '/signup', icon: personAdd }
]
],
tutorial: [
{ title: 'Show Tutorial', path: '/tutorial', icon: hammer },
],
};

type Props = RouteComponentProps<{}> & ReturnType<typeof mapStateToProps>;

const Menu: React.SFC<Props> = ({ isAuthenticated, history }) => {
const Menu: React.FunctionComponent<Props> = ({ isAuthenticated, history }) => {
function renderlistItems(list: any[]) {
return list
.filter(route => !!route.path)
Copy link
Author

@russok russok Aug 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all paths are truthy, no need for filtering

.map(p => (
<IonMenuToggle key={p.title} auto-hide="false">
<IonItem button onClick={() => history.push(p.path)}>
<IonIcon slot="start" icon={p.icon} />
<IonLabel>{p.title}</IonLabel>
.map(item => (
<IonMenuToggle key={item.title} auto-hide="false">
<IonItem button onClick={() => history.push(item.path)}>
<IonIcon slot="start" icon={item.icon} />
<IonLabel>{item.title}</IonLabel>
</IonItem>
</IonMenuToggle>
));
Expand All @@ -77,14 +79,11 @@ const Menu: React.SFC<Props> = ({ isAuthenticated, history }) => {
</IonList>
<IonList>
<IonListHeader>Account</IonListHeader>
{isAuthenticated ? renderlistItems(routes.loggedOutPages) : renderlistItems(routes.loggedInPages)}
{renderlistItems(isAuthenticated ? routes.loggedInPages : routes.loggedOutPages)}
</IonList>
<IonList>
<IonListHeader>Tutorial</IonListHeader>
<IonItem onClick={() => {}}>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the handler like that disables the item

<IonIcon slot="start" icon={hammer} />
Show Tutorial
</IonItem>
{renderlistItems(routes.tutorial)}
</IonList>
</IonContent>
</IonMenu>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Support.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export default class Support extends Component {
<IonList no-lines>
<IonItem>
<IonLabel color="primary">Enter your support message below</IonLabel>
</IonItem>
<IonItem>
<IonTextarea name="supportQuestion" required></IonTextarea>
</IonItem>
</IonList>
Expand Down
6 changes: 4 additions & 2 deletions src/utils/routing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ class PRoute extends Component<Props> {

class RTRoute extends Component<Props> {
render() {
const needTutorial = !this.props.user.hasSeenTutorial;

return (
<>
{ !this.props.user.hasSeenTutorial ? <Tutorial /> : null }
<div style={!this.props.user.hasSeenTutorial ? { "display": "none"} : {}}>
{ needTutorial ? <Tutorial /> : null }
<div style={needTutorial ? {display: "none"} : {height: "100%"}}>
<Route {...this.props}/>
</div>
</>
Expand Down