Skip to content

Commit

Permalink
Merge pull request #209 from labzero/feature/title-description
Browse files Browse the repository at this point in the history
Update page titles and description
  • Loading branch information
nyscherm authored May 9, 2018
2 parents 50b4ad4 + 0535c2e commit d7fd7e5
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/ErrorPage/ErrorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function ErrorPage({ error }) {
let errorMessage = null;

if (error.status === 404) {
title = 'Page Not Found';
title = 'Page not found';
content = 'Sorry, the page you were trying to view does not exist.';
} else if (process.env.NODE_ENV !== 'production') {
errorMessage = <pre>{error.stack}</pre>;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/helpers/render404.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import LayoutContainer from '../../components/Layout/LayoutContainer';
import NotFound from '../not-found/NotFound';

const title = 'Page Not Found';
const title = 'Page not found';

export default (context) => ({
chunks: ['not-found'],
Expand Down
4 changes: 3 additions & 1 deletion src/routes/helpers/rootAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ export default async ({ next }) => {

// Provide default values for title, description etc.
const title = 'Lunch';
if (route.title) {
if (route.fullTitle) {
route.title = route.fullTitle;
} else if (route.title) {
route.title = `${title} | ${route.title}`;
} else {
route.title = title;
Expand Down
1 change: 1 addition & 0 deletions src/routes/login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function action(context) {
<LoginContainer team={subdomain} next={next} />
</LayoutContainer>
),
title: 'Log in',
}));
}

Expand Down
1 change: 1 addition & 0 deletions src/routes/main/invitation/create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ export default (context) => {
<Create success={success} token={token} />
</LayoutContainer>
),
title: 'Invitation',
};
};
1 change: 1 addition & 0 deletions src/routes/main/invitation/new/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ export default (context) => {
<New email={email} />
</LayoutContainer>
),
title: 'Invitation',
};
};
1 change: 1 addition & 0 deletions src/routes/main/landing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ export default (context) => {
<Landing />
</LayoutContainer>
),
fullTitle: 'Lunch – Team voting for nearby restaurants',
}));
};
2 changes: 1 addition & 1 deletion src/routes/main/new-team/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import LayoutContainer from '../../../components/Layout/LayoutContainer';
import renderIfHasName from '../../helpers/renderIfHasName';
import NewTeamContainer from './NewTeamContainer';

const title = 'New Team';
const title = 'New team';

export default (context) => renderIfHasName(context, () => ({
title,
Expand Down
1 change: 1 addition & 0 deletions src/routes/main/password/create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default (context) => {
<Create success={success} />
</LayoutContainer>
),
title: 'Reset password',
};
});
};
1 change: 1 addition & 0 deletions src/routes/main/password/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default (context) => {
<Edit token={token} />
</LayoutContainer>
),
title: 'Reset password',
};
});
};
1 change: 1 addition & 0 deletions src/routes/main/password/new/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ export default (context) => {
<New email={email} />
</LayoutContainer>
),
title: 'Reset password',
}));
};
1 change: 1 addition & 0 deletions src/routes/main/teams/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ import TeamsContainer from './TeamsContainer';
export default (context) => renderIfHasName(context, () => ({
chunks: ['teams'],
component: <LayoutContainer path={context.pathname}><TeamsContainer /></LayoutContainer>,
title: 'My teams',
}));
1 change: 1 addition & 0 deletions src/routes/main/users/create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default (context) => {
<Create />
</LayoutContainer>
),
title: 'New user',
};
}

Expand Down
3 changes: 2 additions & 1 deletion src/routes/main/users/new/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export default (context) => {
<LayoutContainer path={context.pathname}>
<New email={email} />
</LayoutContainer>
)
),
title: 'New user',
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ const render = async (req, res, next) => {
const data = { ...route,
apikey: process.env.GOOGLE_CLIENT_APIKEY || '',
title: route.title || 'Lunch',
description: 'An app for groups to decide on nearby lunch options.',
description: 'A simple lunch voting app for you and your team. Search nearby restaurants, add them to your list, vote for as many as you like, and decide on today’s pick!',
body: '',
root: generateUrl(req, req.get('host')),
};
Expand Down
2 changes: 1 addition & 1 deletion test/integration/other.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('other pages', () => {
await page.goto('http://local.lunch.pink:3000/404');
await page.waitForSelector('#app', helpers.waitOptions);
const content = await page.content();
expect(content).to.contain('Page Not Found');
expect(content).to.contain('Page not found');
});
});
});

0 comments on commit d7fd7e5

Please sign in to comment.