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

Update docs #1012

Merged
merged 4 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ way to update this template, but currently, we follow a pattern:

## Upcoming version 2019-XX-XX

- [#1012] Some of the documentation moved to Flex Docs: https://www.sharetribe.com/docs/
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be in the same format as the other changelog updates

- [change] Some of the documentation moved to Flex Docs: https://www.sharetribe.com/docs/
[#1013]](https://github.com/sharetribe/flex-template-web/pull/1012)

- [fix] Allow ownListing as listing proptype in BookingPanel component.
[#1007](https://github.com/sharetribe/flex-template-web/pull/1007)
- [add] Add info text about additional owners to `PayoutDetailsForm`.
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ yarn run config # add the mandato
yarn run dev # start the dev server, this will open a browser in localhost:3000
```

See the [Environment configuration variables](docs/env.md) documentation for more information of the
required configuration variables.
You can also follow along the
[Getting started with FTW](https://www.sharetribe.com/docs/tutorials/getting-started-with-ftw/)
tutorial in the [Flex Docs website](https://www.sharetribe.com/docs/).

For more information of the configuration, see the
[FTW Environment configuration variables](https://www.sharetribe.com/docs/references/ftw-env/)
reference in Flex Docs.

**Note:** If you want to build your own Flex marketplace on top of the template, you should fork the
repository instead of cloning it. See the [Customization guide](./docs/customization-guide.md).
Expand Down
84 changes: 54 additions & 30 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,33 @@ used in a browser environment using the JavaScript SDK.

Marketplace features included in Saunatime:

- **Location search** shows the user if there are saunas available in a given location.
- **The listing page** gives a detailed view about what a particular sauna offers.
- **Transaction process**: Saunatime uses nightly booking.
- **Notifications**: Emails are sent during the booking process to alert customers and providers
* **Location search** shows the user if there are saunas available in a given location.
* **The listing page** gives a detailed view about what a particular sauna offers.
* **Transaction process**: Saunatime uses nightly booking.
* **Notifications**: Emails are sent during the booking process to alert customers and providers
about changes in the booking state.
- **Inbox** lists **orders** and **sales**.
- **Reviews** can be given after a completed transaction.
- **User profiles** provide detailed information about a given user.
- **Extended data:** The listing and user data models are modified using extended data.
* **Inbox** lists **orders** and **sales**.
* **Reviews** can be given after a completed transaction.
* **User profiles** provide detailed information about a given user.
* **Extended data:** The listing and user data models are modified using extended data.

## Flex Docs website

We are currently moving documentation to the Flex Docs site, so at the moment part of the
documentation is in this repository and part is in the Flex Docs site.

See the Flex Docs site: https://www.sharetribe.com/docs/

## Getting started

We recommend going through the
[Getting started articles](https://www.sharetribe.com/docs/background/getting-started/) in the Flex
Docs:

* [Introducing Flex](https://www.sharetribe.com/docs/background/introducing-flex/)
* [What development skills are needed?](https://www.sharetribe.com/docs/background/development-skills/)
* [Getting started with FTW](https://www.sharetribe.com/docs/tutorials/getting-started-with-ftw/)
tutorial.

## How to customize this template

Expand All @@ -33,28 +51,34 @@ The easiest way to start a customization project is to read through the

Documentation for specific topics can be found in the following files:

- [Customization guide](customization-guide.md)
- [Folder structure](folder-structure.md)
- [Integration to map providers](map-providers.md)
- [Translations](translations.md)
- [Styling a marketplace](styling.md)
- [Static pages](static-pages.md)
- [Terms of Service and Privacy Policy](terms-of-service-and-privacy-policy.md)
- [Routing](routing.md)
- [Redux and duck files](redux.md)
- [Extended data](extended-data.md)
- [Extend the listing data model](extend-listing.md)
- [Search filters](search-filters.md)
- [Testing](testing.md)
- [Error logging with Sentry](sentry.md)
- [Analytics](analytics.md)
- [Continuous Integration (CI)](ci.md)
- [Content Security Policy (CSP)](content-security-policy.md)
- [Original create-react-app documentation](https://github.com/sharetribe/create-react-app/blob/master/packages/react-scripts/template/README.md)
- [Customization checklist](customization-checklist.md)
- [Icons](icons.md)
- [Improving performance](improving-performance.md)
- [Deploying to production](deploying-to-production.md)
* [Customization guide](customization-guide.md)
* [Folder structure](folder-structure.md)
* [Translations](translations.md)
* [Styling a marketplace](styling.md)
* [Static pages](static-pages.md)
* [Terms of Service and Privacy Policy](terms-of-service-and-privacy-policy.md)
* [Routing](routing.md)
* [Redux and duck files](redux.md)
* [Extended data](extended-data.md)
* See also the
[Extended data reference](https://www.sharetribe.com/docs/references/extended-data/) in Flex
Docs
* [Extend the listing data model](extend-listing.md)
* [Search filters](search-filters.md)
* [Testing](testing.md)
* [Continuous Integration (CI)](ci.md)
* [Original create-react-app documentation](https://github.com/sharetribe/create-react-app/blob/master/packages/react-scripts/template/README.md)
* [Customization checklist](customization-checklist.md)
* [Icons](icons.md)
* [Improving performance](improving-performance.md)
* [Deploying to production](deploying-to-production.md)

See also the following articles in the [Flex Docs](https://www.sharetribe.com/docs/) website:

* [How to set up Mapbox for FTW](https://www.sharetribe.com/docs/guides/how-to-set-up-mapbox-for-ftw/)
* [How to set up Sentry to log errors in FTW](https://www.sharetribe.com/docs/guides/how-to-set-up-sentry-to-log-errors-in-ftw/)
* [How to set up Analytics for FTW](https://www.sharetribe.com/docs/guides/how-to-set-up-analytics-for-ftw/)
* [How to set up Content Security Policy (CSP) for FTW](https://www.sharetribe.com/docs/guides/how-to-set-up-csp-for-ftw/)

The application was bootstrapped with a forked version of
[create-react-app](https://github.com/facebookincubator/create-react-app). While most of the
Expand Down
36 changes: 2 additions & 34 deletions docs/analytics.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,5 @@
# Analytics

The application supports tracking page views with pluggable analytics handlers.
Documentation moved to the Flex Docs site:

## Google Analytics

Google Analytics (GA) is supported by default. The enable GA, set the GA tracker ID to the
environment variable `REACT_APP_GOOGLE_ANALYTICS_ID`;

## Custom analytics handler

If you want to add a new analytics library, you can do as follows:

1. Add the analytics library script

If the analytics library has an external script, add the library script tag to the
[src/public/index.html](../public/index.html) file. If you need more control, see how the GA
script is added in [server/renderer.js](../server/renderer.js).

1. Create a handler

To track page views, create a custom handler e.g. in
[src/analytics/handlers.js](../src/analytics/handlers.js). The handler should be a class that
implements a `trackPageView(url)` method.

Note that the `url` parameter might not be the same as in the URL bar of the browser. It is the
canonical form of the URL. For example, in the listing page it doesn't have the dynamic title
slug in the middle. This allows unified analytics and correct tracking of pages that can be
accessed from multiple different URLs.

If you analytics library takes the page URL from the browser, you might need to override that
behavior to use the canonical URL that is given to the method.

1. Initialise the handler

Initialise the handler in the `setupAnalyticsHandlers()` function in
[src/index.js](../src/index.js).
https://www.sharetribe.com/docs/guides/how-to-set-up-analytics-for-ftw/
42 changes: 2 additions & 40 deletions docs/content-security-policy.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,5 @@
# Content Security Policy (CSP)

According to [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP):
Documentation moved to the Flex Docs site:

> Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate
> certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks. These
> attacks are used for everything from data theft to site defacement or distribution of malware.

This document describes how to use a CSP with the Flex template app. By default the CSP is disabled.
By turning it on, the default whitelist in [server/csp.js](../server/csp.js) works with the all the
URLs and tools that come with the application.

## Setup

The CSP is configured using the `REACT_APP_CSP` environment variable.

Possible values:

- not set: disabled
- `REACT_APP_CSP=report`: Enabled, but policy violations are only reported
- `REACT_APP_CSP=block`: Enabled. Policy violations are reported and requests that violate the
policy are blocked

If error logging with Sentry is enabled (See [Error logging with Sentry](sentry.md)), the reports
are sent to Sentry. Otherwise the reports are just logged in the backend.

## Extending the policy

If you want to whitelist new sources (for example adding a new external analytics service) and keep
the CSP enabled, you should add the domains to the white list in [server/csp.js](../server/csp.js).

The easiest way to do this is to first turn on the policy in report mode and then see what policy
violations are logged to the browser developer console or to the backend policy violation report
URL.

## Resources

To understand what CSP is and how browsers work, here are some resources:

- https://content-security-policy.com/
- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
- https://ponyfoo.com/articles/content-security-policy-in-express-apps
- https://helmetjs.github.io/docs/csp/
https://www.sharetribe.com/docs/guides/how-to-set-up-csp-for-ftw/
56 changes: 29 additions & 27 deletions docs/customization-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,42 @@

Some generic things to update and check when starting to customize the template.

- [Marketplace colors](styling.md)
- [Generate app icons](icons.md)
- [Update translations](../src/translations/en.json) or [change the language](translations.md)
- [LandingPage](../src/containers/LandingPage/LandingPage.js): update and create branded sections
- [Footer](../src/components/Footer/Footer.js)
- [AboutPage](../src/containers/AboutPage/AboutPage.js)
- [Terms of Service](terms-of-service-and-privacy-policy.md#terms-of-service)
- [Privacy Policy](terms-of-service-and-privacy-policy.md#privacy-policy)
- [Social media sharing graphics](../src/components/Page/Page.js);
- [Logo](../src/components/Logo/Logo.js) Change and check that it works on Topbar, Footer, and
* [Marketplace colors](styling.md)
* [Generate app icons](icons.md)
* [Update translations](../src/translations/en.json) or [change the language](translations.md)
* [LandingPage](../src/containers/LandingPage/LandingPage.js): update and create branded sections
* [Footer](../src/components/Footer/Footer.js)
* [AboutPage](../src/containers/AboutPage/AboutPage.js)
* [Terms of Service](terms-of-service-and-privacy-policy.md#terms-of-service)
* [Privacy Policy](terms-of-service-and-privacy-policy.md#privacy-policy)
* [Social media sharing graphics](../src/components/Page/Page.js);
* [Logo](../src/components/Logo/Logo.js) Change and check that it works on Topbar, Footer, and
CheckoutPage
- [Default background image](../src/assets/background-1440.jpg)
- [Maps Marker icon](../src/components/Map/images/marker-32x32.png)
- [Config: update environment variables](../src/config.js)
- [Config: siteTitle](../src/config.js) for page schema (SEO)
- [Config: marketplace address](../src/config.js): contact details also improve SEO
- [Config: social media pages](../src/config.js)
- [Marketplace custom config](../src/marketplace-custom-config.js)
- Update [ListingPage](../src/containers/ListingPage/ListingPage.js) to show extended data (aka
* [Default background image](../src/assets/background-1440.jpg)
* [Maps Marker icon](../src/components/Map/images/marker-32x32.png)
* [Config: update environment variables](../src/config.js)
* [Config: siteTitle](../src/config.js) for page schema (SEO)
* [Config: marketplace address](../src/config.js): contact details also improve SEO
* [Config: social media pages](../src/config.js)
* [Marketplace custom config](../src/marketplace-custom-config.js)
* Update [ListingPage](../src/containers/ListingPage/ListingPage.js) to show extended data (aka
publicData attribute)
- Update [EditListingWizard](../src/components/EditListingWizard/EditListingWizard.js) and panels to
* Update [EditListingWizard](../src/components/EditListingWizard/EditListingWizard.js) and panels to
add extended data
- Update [SearchPage](../src/containers/SearchPage/SearchPage.js) to filter with extended data
- Update [routeConfiguration](../src/routeConfiguration.js) if needed
- Update [Email templates](../ext/default-mail-templates), all of them: .html, subject.txt, and
* Update [SearchPage](../src/containers/SearchPage/SearchPage.js) to filter with extended data
* Update [routeConfiguration](../src/routeConfiguration.js) if needed
* Update [Email templates](../ext/default-mail-templates), all of them: .html, subject.txt, and
text.txt
- Update [config: bookingUnitType](../src/config.js) if needed
- If `line-item/units` is used, add quantity handling to
* See the [Email template reference](https://www.sharetribe.com/docs/references/email-templates/)
in Flex Docs for more information.
* Update [config: bookingUnitType](../src/config.js) if needed
* If `line-item/units` is used, add quantity handling to
[BookingDatesForm](../src/forms/BookingDatesForm/BookingDatesForm.js),
[ListingPage](../src/containers/ListingPage/ListingPage.js),
[CheckoutPage](../src/containers/CheckoutPage/CheckoutPage.js)

## What else

- Do you need more [static pages](static-pages.md)?
- Changes to existing pages
- Changes to transaction process (API + Web app)
* Do you need more [static pages](static-pages.md)?
* Changes to existing pages
* Changes to transaction process (API + Web app)
36 changes: 24 additions & 12 deletions docs/customization-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ will help you in setting up your fork and describes the general workflow.
README file, you probably don't want to make the customizations in that project. Forking the
repository is the recommended way to proceed. Follow this guide for instructions.

## Getting started

We recommend going through the
[Getting started articles](https://www.sharetribe.com/docs/background/getting-started/) in the Flex
Docs:

* [Introducing Flex](https://www.sharetribe.com/docs/background/introducing-flex/)
* [What development skills are needed?](https://www.sharetribe.com/docs/background/development-skills/)
* [Getting started with FTW](https://www.sharetribe.com/docs/tutorials/getting-started-with-ftw/)
tutorial.

## Requirements

Install required tools:

- [Node.js](https://nodejs.org/)
- [Yarn](https://yarnpkg.com/)
* [Node.js](https://nodejs.org/)
* [Yarn](https://yarnpkg.com/)

## Technologies

Expand All @@ -24,13 +35,13 @@ get-go.

Here are some main technologies that the template uses:

- JavaScript: programming language for the whole application
- CSS: styling the user interface using [CSS Modules](https://github.com/css-modules/css-modules)
- [React](https://reactjs.org/): library for creating user interfaces with components
- [Redux](https://redux.js.org/): state and data flow handling
- [Final Form](https://github.com/final-form/final-form): forms
- [React Router](https://reacttraining.com/react-router/): routing
- [Express](https://expressjs.com/): server
* JavaScript: programming language for the whole application
* CSS: styling the user interface using [CSS Modules](https://github.com/css-modules/css-modules)
* [React](https://reactjs.org/): library for creating user interfaces with components
* [Redux](https://redux.js.org/): state and data flow handling
* [Final Form](https://github.com/final-form/final-form): forms
* [React Router](https://reacttraining.com/react-router/): routing
* [Express](https://expressjs.com/): server

## Setup

Expand Down Expand Up @@ -99,8 +110,9 @@ This command will create `.env` file and guide you trough setting up the require
variables. The `.env` file is the place to add your local configuration. It is ignored in Git, so
you'll have to add the corresponding configuration also to your server environment.

There are some mandatory configuration variables that are defined in the template. See the
[Environment configuration variables](env.md) documentation for more information.
There are some mandatory configuration variables that are defined in the template. See the Flex Docs
[FTW Environment configuration variables](https://www.sharetribe.com/docs/references/ftw-env/)
reference for more information.

See also the [src/config.js](../src/config.js) file for more configuration options.

Expand All @@ -112,7 +124,7 @@ To develop the application and to see changes live, start the frontend developme

**Known issues:**

- Adding/changing `import`s may not be synced properly with ESLint. You may see an error
* Adding/changing `import`s may not be synced properly with ESLint. You may see an error
`Unable to resolve path to module` even though the module existing in right path. Restarting the
server doesn't help. To solve the issue, you need to make a change to the file where the error
occurs.
Expand Down
Loading