ListingPage url changed from l/:slug-:id syntax to l/:slug/:id

This commit is contained in:
Vesa Luusua 2017-01-23 20:04:12 +02:00
parent f8333f51a9
commit 63eb5a754c
24 changed files with 29 additions and 38 deletions

View file

@ -25,7 +25,7 @@ describe('Application', () => {
const urlTitles = {
'/': 'Landing page',
'/s': 'Search page',
'/l/1234': 'Listing page with listing id: #1234',
'/l/listing-title-slug/1234': 'Listing page with listing id: #1234',
'/u/1234': 'Profile page with display name: 1234',
'/checkout/1234': 'Checkout page: 1234',
'/login': 'Authentication page: login tab',

View file

@ -19,7 +19,7 @@ exports[`AuthenticationPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`CheckoutPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`ContactDetailsPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`ConversationPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`EditProfilePage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`InboxPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`LandingPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -2,21 +2,12 @@ import React, { PropTypes } from 'react';
import { Link } from 'react-router';
import { PageLayout } from '../../components';
const ListingPage = ({ params }) => {
// Listing id should be located either in the end of slug
// - https://example.com/l/listing-title-as-slug-12345
// - https://example.com/l/12345
const slugAndId = params.slug.split('-');
const id = slugAndId[slugAndId.length - 1];
// TODO: Fetch data from SDK if no data is passed through props
return (
<PageLayout title={`Listing page with listing id: #${id}`}>
<p>Slug: {params.slug}</p>
<Link to={`/checkout/${id}`}><button>Book</button></Link>
</PageLayout>
);
};
const ListingPage = ({ params }) => (
<PageLayout title={`Listing page with listing id: #${params.id}`}>
<p>Slug: {params.slug}</p>
<Link to={`/checkout/${params.id}`}><button>Book</button></Link>
</PageLayout>
);
const { shape, string } = PropTypes;

View file

@ -8,7 +8,7 @@ describe('ListingPage', () => {
const component = renderer.create(
(
<BrowserRouter>
<ListingPage params={{ slug: 'really-nice-house-1234' }} />
<ListingPage params={{ slug: 'really-nice-house-1234', id: 1234 }} />
</BrowserRouter>
),
);

View file

@ -19,7 +19,7 @@ exports[`ListingPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`ManageListingsPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`NotFoundPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`NotificationSettingsPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`OrderPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`PasswordChangePage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`PasswordForgottenPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`PaymentMethodsPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`PayoutPreferencesPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`ProfilePage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`SalesConversationPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`SearchPageComponent matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -19,7 +19,7 @@ exports[`SecurityPage matches snapshot 1`] = `
</a>
<a
className=""
href="/l/Bike-Pelago-12345"
href="/l/Bike-Pelago/12345"
onClick={[Function]}
style={Object {}}>
Listing page

View file

@ -24,7 +24,7 @@ const Topbar = (props, context) => {
<div className={css.container}>
<Link to="/" {...linkProps}>Home</Link>
<Link to="/s" {...linkProps}>Search</Link>
<Link to="/l/Bike-Pelago-12345" {...linkProps}>Listing page</Link>
<Link to="/l/Bike-Pelago/12345" {...linkProps}>Listing page</Link>
<Link to="/u/Bikerrs" {...linkProps}>Profile</Link>
<Link to="/u/Bikerrs/edit" {...linkProps}>Edit profile</Link>
<Link to="/checkout/lid1234" {...linkProps}>Checkout</Link>