generator-folklore 3.0.3 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. package/lib/generators/app/index.js +3 -51
  2. package/lib/generators/babel/index.js +28 -101
  3. package/lib/generators/babel/templates/config.js +16 -0
  4. package/lib/generators/browserslist/index.js +4 -9
  5. package/lib/generators/build/index.js +40 -29
  6. package/lib/generators/cli/index.js +92 -0
  7. package/lib/generators/cli/templates/cli.js +22 -0
  8. package/lib/generators/cli/templates/commands/default.js +16 -0
  9. package/lib/generators/docs/index.js +1 -2
  10. package/lib/generators/editorconfig/index.js +12 -22
  11. package/lib/generators/eslint/index.js +12 -13
  12. package/lib/generators/{html → html-project}/index.js +60 -73
  13. package/lib/generators/{html → html-project}/templates/folklore.png +0 -0
  14. package/lib/generators/{html → html-project}/templates/gitignore +0 -0
  15. package/lib/generators/{html → html-project}/templates/index.html.ejs +4 -1
  16. package/lib/generators/intl/index.js +93 -0
  17. package/lib/generators/laravel/index.js +5 -5
  18. package/lib/generators/laravel-mediatheque/index.js +133 -0
  19. package/lib/generators/laravel-mediatheque/templates/app/Models/Media.php +9 -0
  20. package/lib/generators/laravel-mediatheque/templates/app/Models/MediaFile.php +9 -0
  21. package/lib/generators/laravel-panneau/index.js +49 -28
  22. package/lib/generators/laravel-panneau/templates/app/Contracts/Repositories/Pages.php +19 -0
  23. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Text.php +10 -0
  24. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Page.php +10 -0
  25. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Pages/Home.php +9 -0
  26. package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlockResource.php +37 -0
  27. package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlocksCollection.php +8 -0
  28. package/lib/generators/laravel-panneau/templates/app/Http/Resources/PageResource.php +47 -0
  29. package/lib/generators/laravel-panneau/templates/app/Http/Resources/PagesCollection.php +10 -0
  30. package/lib/generators/laravel-panneau/templates/app/Models/Block.php +3 -13
  31. package/lib/generators/laravel-panneau/templates/app/Models/Page.php +3 -60
  32. package/lib/generators/laravel-panneau/templates/app/Panneau/Composers/AppComposer.php +50 -0
  33. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Block.php +22 -0
  34. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Blocks.php +87 -0
  35. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Page.php +51 -0
  36. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlug.php +34 -0
  37. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlugLocalized.php +18 -0
  38. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/AccountController.php +41 -0
  39. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/Controller.php +19 -0
  40. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/HomeController.php +16 -0
  41. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/PagesController.php +24 -0
  42. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UploadController.php +27 -0
  43. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UsersController.php +32 -0
  44. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/AccountUpdateRequest.php +29 -0
  45. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/UploadRequest.php +29 -0
  46. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlockResource.php +39 -0
  47. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlocksCollection.php +8 -0
  48. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PageResource.php +56 -0
  49. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PagesCollection.php +10 -0
  50. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/UserResource.php +24 -0
  51. package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +48 -0
  52. package/lib/generators/laravel-panneau/templates/app/Panneau/Policies/PanneauPolicy.php +32 -0
  53. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/BlockWithBlocks.php +110 -0
  54. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/TextBlock.php +27 -0
  55. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks.php +42 -0
  56. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages/Page.php +28 -0
  57. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages.php +92 -0
  58. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Users.php +57 -0
  59. package/lib/generators/laravel-panneau/templates/app/Repositories/Pages.php +42 -0
  60. package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/TextBlock.php +14 -0
  61. package/lib/generators/laravel-panneau/templates/app/Resources/Page.php +10 -0
  62. package/lib/generators/laravel-panneau/templates/app/Resources/Pages/HomePage.php +10 -0
  63. package/lib/generators/laravel-panneau/templates/app.blade.php +8 -0
  64. package/lib/generators/laravel-panneau/templates/index.js +32 -0
  65. package/lib/generators/laravel-panneau/templates/lang/en/panneau.php +62 -0
  66. package/lib/generators/laravel-panneau/templates/lang/fr/panneau.php +62 -0
  67. package/lib/generators/laravel-panneau/templates/layout.blade.php +17 -48
  68. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/Panneau.jsx +68 -0
  69. package/lib/generators/{js/templates/src/lib/.gitkeep → laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlug.jsx} +0 -0
  70. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlugLocalized.jsx +43 -0
  71. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/index.js +2 -0
  72. package/lib/generators/laravel-panneau/templates/resources/assets/styles/panneau.scss +2 -0
  73. package/lib/generators/laravel-panneau/templates/routes.php +30 -0
  74. package/lib/generators/laravel-project/index.js +504 -0
  75. package/lib/generators/laravel-project/templates/env +41 -0
  76. package/lib/generators/laravel-project/templates/laravel/app/Composers/AppComposer.php +48 -0
  77. package/lib/generators/laravel-project/templates/laravel/app/Composers/IntlComposer.php +10 -0
  78. package/lib/generators/laravel-project/templates/laravel/app/Composers/MetaComposer.php +48 -0
  79. package/lib/generators/laravel-project/templates/laravel/app/Composers/RoutesComposer.php +19 -0
  80. package/lib/generators/laravel-project/templates/laravel/app/Contracts/Resources/User.php +10 -0
  81. package/lib/generators/laravel-project/templates/laravel/app/Http/Controllers/HomeController.php +18 -0
  82. package/lib/generators/laravel-project/templates/laravel/app/Http/Middleware/TrustProxies.php +28 -0
  83. package/lib/generators/laravel-project/templates/laravel/app/Http/Resources/UserResource.php +21 -0
  84. package/lib/generators/laravel-project/templates/laravel/app/Models/User.php +50 -0
  85. package/lib/generators/laravel-project/templates/laravel/app/Providers/AppServiceProvider.php +45 -0
  86. package/lib/generators/laravel-project/templates/laravel/app/Providers/RouteServiceProvider.php +64 -0
  87. package/lib/generators/laravel-project/templates/laravel/app/Providers/ViewServiceProvider.php +33 -0
  88. package/lib/generators/laravel-project/templates/laravel/app/Repositories/Users.php +36 -0
  89. package/lib/generators/laravel-project/templates/laravel/app/Resources/User.php +11 -0
  90. package/lib/generators/laravel-project/templates/laravel/config/app.php +216 -0
  91. package/lib/generators/laravel-project/templates/laravel/config/auth.php +116 -0
  92. package/lib/generators/laravel-project/templates/laravel/config/services.php +39 -0
  93. package/lib/generators/laravel-project/templates/laravel/lang/en/content.php +5 -0
  94. package/lib/generators/laravel-project/templates/laravel/lang/en/errors.php +17 -0
  95. package/lib/generators/laravel-project/templates/laravel/lang/en/meta.php +11 -0
  96. package/lib/generators/laravel-project/templates/laravel/lang/en/routes.php +4 -0
  97. package/lib/generators/laravel-project/templates/laravel/lang/fr/auth.php +19 -0
  98. package/lib/generators/laravel-project/templates/laravel/lang/fr/content.php +5 -0
  99. package/lib/generators/laravel-project/templates/laravel/lang/fr/errors.php +17 -0
  100. package/lib/generators/laravel-project/templates/laravel/lang/fr/meta.php +11 -0
  101. package/lib/generators/laravel-project/templates/laravel/lang/fr/pagination.php +19 -0
  102. package/lib/generators/laravel-project/templates/laravel/lang/fr/passwords.php +22 -0
  103. package/lib/generators/laravel-project/templates/laravel/lang/fr/routes.php +12 -0
  104. package/lib/generators/laravel-project/templates/laravel/lang/fr/validation.php +146 -0
  105. package/lib/generators/{js/templates/styles → laravel-project/templates/laravel/resources/assets/fonts}/.gitkeep +0 -0
  106. package/lib/generators/{laravel-panneau/templates/app/Schemas/Fields → laravel-project/templates/laravel/resources/assets/img}/.gitkeep +0 -0
  107. package/lib/generators/laravel-project/templates/laravel/resources/assets/img/folklore.png +0 -0
  108. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/body.blade.php +3 -0
  109. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/gpt.blade.php +16 -0
  110. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/head.blade.php +1 -0
  111. package/lib/generators/laravel-project/templates/laravel/resources/views/app.blade.php +8 -0
  112. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/401.blade.php +8 -0
  113. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/403.blade.php +8 -0
  114. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/404.blade.php +8 -0
  115. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/500.blade.php +8 -0
  116. package/lib/generators/laravel-project/templates/laravel/resources/views/layout.blade.php +33 -0
  117. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/all.blade.php +4 -0
  118. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/base.blade.php +11 -0
  119. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/facebook.blade.php +4 -0
  120. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/opengraph.blade.php +9 -0
  121. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/twitter.blade.php +5 -0
  122. package/lib/generators/laravel-project/templates/laravel/routes/web.php +12 -0
  123. package/lib/generators/lerna-package/index.js +1 -3
  124. package/lib/generators/lerna-repository/index.js +1 -3
  125. package/lib/generators/node-project/index.js +164 -0
  126. package/lib/generators/node-project/templates/index.js +0 -0
  127. package/lib/generators/npm-package/index.js +3 -5
  128. package/lib/generators/prettier/index.js +19 -6
  129. package/lib/generators/prettier/templates/prettierrc.json +3 -1
  130. package/lib/generators/{js → react-app}/index.js +22 -52
  131. package/lib/generators/{js → react-app}/templates/_package.json +0 -0
  132. package/lib/generators/react-app/templates/index.js +23 -0
  133. package/lib/generators/react-app/templates/src/components/App.jsx +46 -0
  134. package/lib/generators/react-app/templates/src/components/Container.jsx +40 -0
  135. package/lib/generators/{js → react-app}/templates/src/components/buttons/Button.jsx +4 -18
  136. package/lib/generators/react-app/templates/src/components/layouts/Main.jsx +27 -0
  137. package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +62 -0
  138. package/lib/generators/{js → react-app}/templates/src/components/pages/Error.jsx +10 -14
  139. package/lib/generators/react-app/templates/src/components/pages/Home.jsx +32 -0
  140. package/lib/generators/{js → react-app}/templates/src/components/partials/PageMeta.jsx +11 -11
  141. package/lib/generators/{js → react-app}/templates/src/contexts/KeysContext.jsx +0 -0
  142. package/lib/generators/react-app/templates/src/lib/.gitkeep +0 -0
  143. package/lib/generators/{js → react-app}/templates/src/lib/PropTypes.js +0 -0
  144. package/lib/generators/{js → react-app}/templates/src/lib/utils.js +0 -0
  145. package/lib/generators/react-app/templates/src/polyfills/index.js +6 -0
  146. package/lib/generators/react-app/templates/src/polyfills/intl-en.js +2 -0
  147. package/lib/generators/react-app/templates/src/polyfills/intl-fr.js +2 -0
  148. package/lib/generators/react-app/templates/src/polyfills/should.js +14 -0
  149. package/lib/generators/react-app/templates/styles/.gitkeep +0 -0
  150. package/lib/generators/{js/templates/styles/buttons/button.scss → react-app/templates/styles/buttons/button.module.scss} +1 -0
  151. package/lib/generators/{js/templates/styles/layouts/main.scss → react-app/templates/styles/layouts/main.module.scss} +0 -0
  152. package/lib/generators/{js/templates/styles/menus/menu.scss → react-app/templates/styles/menus/menu.module.scss} +0 -0
  153. package/lib/generators/{js/templates/styles/pages/error.scss → react-app/templates/styles/pages/error.module.scss} +0 -0
  154. package/lib/generators/{js/templates/styles/pages/home.scss → react-app/templates/styles/pages/home.module.scss} +0 -0
  155. package/lib/generators/rollup/index.js +54 -0
  156. package/lib/generators/rollup/templates/config.js +50 -0
  157. package/lib/generators/scss/index.js +3 -16
  158. package/lib/generators/scss/templates/{main.scss → styles.scss} +0 -0
  159. package/lib/generators/server/index.js +81 -0
  160. package/lib/generators/server/templates/server.js +59 -0
  161. package/lib/generators/storybook/index.js +1 -7
  162. package/lib/generators/stylelint/index.js +13 -14
  163. package/lib/lib/generator.js +9 -0
  164. package/lib/lib/utils.js +17 -0
  165. package/package.json +2 -2
  166. package/lib/generators/babel/templates/babel-preset-react.js +0 -7
  167. package/lib/generators/babel/templates/babel-preset.js +0 -57
  168. package/lib/generators/babel/templates/babelrc +0 -5
  169. package/lib/generators/babel/templates/utils/processScss.js +0 -10
  170. package/lib/generators/babel/templates/utils/transformRequireIgnore.js +0 -80
  171. package/lib/generators/html/templates/index.js +0 -9
  172. package/lib/generators/html/templates/root.js +0 -23
  173. package/lib/generators/html/templates/utils.js +0 -7
  174. package/lib/generators/js/templates/browserslistrc +0 -9
  175. package/lib/generators/js/templates/config.js +0 -33
  176. package/lib/generators/js/templates/index.js +0 -41
  177. package/lib/generators/js/templates/src/actions/LayoutActions.js +0 -12
  178. package/lib/generators/js/templates/src/actions/SiteActions.js +0 -22
  179. package/lib/generators/js/templates/src/components/App.jsx +0 -52
  180. package/lib/generators/js/templates/src/components/Root.jsx +0 -70
  181. package/lib/generators/js/templates/src/components/layouts/Main.jsx +0 -52
  182. package/lib/generators/js/templates/src/components/menus/Menu.jsx +0 -60
  183. package/lib/generators/js/templates/src/components/messages/Success.jsx +0 -36
  184. package/lib/generators/js/templates/src/components/pages/Home.jsx +0 -32
  185. package/lib/generators/js/templates/src/components/partials/Label.jsx +0 -32
  186. package/lib/generators/js/templates/src/reducers/LayoutReducer.js +0 -32
  187. package/lib/generators/js/templates/src/reducers/SiteReducer.js +0 -36
  188. package/lib/generators/js/templates/src/reducers/index.js +0 -7
  189. package/lib/generators/js/templates/src/vendor/polyfills/intl-en.js +0 -2
  190. package/lib/generators/js/templates/src/vendor/polyfills/intl-fr.js +0 -2
  191. package/lib/generators/laravel-panneau/templates/_composer.json +0 -6
  192. package/lib/generators/laravel-panneau/templates/_package.json +0 -11
  193. package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/HomeController.php +0 -14
  194. package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/PagesController.php +0 -11
  195. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/File.php +0 -13
  196. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Picture.php +0 -13
  197. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Video.php +0 -34
  198. package/lib/generators/laravel-panneau/templates/app/Providers/PanneauServiceProvider.php +0 -23
  199. package/lib/generators/laravel-panneau/templates/app/Reducers/SlugExtractReducer.php +0 -18
  200. package/lib/generators/laravel-panneau/templates/app/Resources/Pages.php +0 -54
  201. package/lib/generators/laravel-panneau/templates/app/Schemas/Blocks/Base.php +0 -22
  202. package/lib/generators/laravel-panneau/templates/app/Schemas/Bubbles/Base.php +0 -22
  203. package/lib/generators/laravel-panneau/templates/app/Schemas/Pages/Base.php +0 -36
  204. package/lib/generators/laravel-panneau/templates/resources/lang/en/panneau.php +0 -12
  205. package/lib/generators/laravel-panneau/templates/resources/lang/fr/panneau.php +0 -12
@@ -1,33 +0,0 @@
1
- import get from 'lodash/get';
2
- import set from 'lodash/set';
3
-
4
- class Config {
5
- constructor(config) {
6
- this.config = config || {};
7
- }
8
-
9
- get(str) {
10
- return get(this.config, str);
11
- }
12
-
13
- set(str, val) {
14
- return set(this.config, str, val);
15
- }
16
- }
17
-
18
- const config = new Config();
19
-
20
- // eslint-disable-next-line no-unused-vars
21
- const configFunc = (key, value) => {
22
- if (typeof value !== 'undefined') {
23
- return config.set(key, value);
24
- } else if (typeof key === 'undefined') {
25
- return config.get();
26
- }
27
- return config.get(key);
28
- };
29
-
30
- const root = global || window || null;
31
- if (root !== null) {
32
- root.app_config = configFunc;
33
- }
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
- import domready from 'domready';<% if (rootPropsImport !== null) { %>
4
- import defaultRootProps from '<%= rootPropsImport %>';<% } %>
5
-
6
- import Root from './components/Root';
7
-
8
- <%
9
- if (rootPropsImport !== null) {
10
- %>const getRootProps = () => defaultRootProps;<%
11
- } else {
12
- %>const getRootProps = () => {
13
- const propsEl = document.getElementById('root-props');
14
- return propsEl !== null ? JSON.parse(propsEl.innerHTML) || {} : {};
15
- };<%
16
- }
17
- %>
18
-
19
- const renderRoot = (props) => {
20
- const rootEl = document.getElementById('root');
21
- const root = React.createElement(Root, props);
22
- ReactDOM.render(root, rootEl);
23
- };
24
-
25
- const boot = () => {
26
- const rootProps = getRootProps();
27
-
28
- if (typeof window.Intl === 'undefined') {
29
- const { locale = 'fr' } = rootProps;
30
- import(`./vendor/polyfills/intl-${locale}`).then(() => renderRoot(rootProps));
31
- } else {
32
- renderRoot(rootProps);
33
- }
34
- };
35
-
36
- const ready = (document.readyState || 'loading') !== 'loading';
37
- if (ready) {
38
- boot();
39
- } else {
40
- domready(boot);
41
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Constants
3
- */
4
- export const SET_SIZE = 'layout@SET_SIZE';
5
-
6
- /**
7
- * Actions creator
8
- */
9
- export const setSize = payload => ({
10
- type: SET_SIZE,
11
- payload,
12
- });
@@ -1,22 +0,0 @@
1
- /**
2
- * Constants
3
- */
4
- export const SET_ERRORS = 'site@SET_ERRORS';
5
- export const RESET_REQUEST = 'site@RESET_REQUEST';
6
-
7
- /**
8
- * Actions creator
9
- */
10
- export const setErrors = payload => ({
11
- type: SET_ERRORS,
12
- payload,
13
- });
14
-
15
- export const resetErrors = () => ({
16
- type: SET_ERRORS,
17
- payload: null,
18
- });
19
-
20
- export const resetRequest = () => ({
21
- type: RESET_REQUEST,
22
- });
@@ -1,52 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { connect } from 'react-redux';
4
- import { Route, Switch, useHistory } from 'react-router';
5
- import { useUrlGenerator } from '@folklore/react-container';
6
-
7
- // import * as AppPropTypes from '../lib/PropTypes';
8
- import { resetRequest as resetRequestAction } from '../actions/SiteActions';
9
- import MainLayout from './layouts/Main';
10
- import HomePage from './pages/Home';
11
- import ErrorPage from './pages/Error';
12
-
13
- import '<%= getRelativeStylesPath('components/App.jsx', 'main.global.scss') %>';
14
-
15
- const propTypes = {
16
- resetRequest: PropTypes.func.isRequired,
17
- };
18
-
19
- const defaultProps = {};
20
-
21
- const App = ({ resetRequest }) => {
22
- const history = useHistory();
23
- const urlGenerator = useUrlGenerator();
24
-
25
- // Reset request on history change
26
- useEffect(() => {
27
- const unlisten = history.listen(() => resetRequest());
28
- return () => {
29
- unlisten();
30
- };
31
- }, [history]);
32
-
33
- return (
34
- <MainLayout>
35
- <Switch>
36
- <Route exact path={urlGenerator.route('home')} component={HomePage} />
37
- <Route path="*" component={ErrorPage} />
38
- </Switch>
39
- </MainLayout>
40
- );
41
- };
42
-
43
- App.propTypes = propTypes;
44
- App.defaultProps = defaultProps;
45
-
46
- const WithStateContainer = connect(
47
- null,
48
- dispatch => ({
49
- resetRequest: () => dispatch(resetRequestAction()),
50
- }),
51
- )(App);
52
- export default WithStateContainer;
@@ -1,70 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { UrlGeneratorProvider, createStore } from '@folklore/react-container';
4
- import { TrackingContainer } from '@folklore/tracking';
5
- import { IntlProvider } from 'react-intl';
6
- import { BrowserRouter } from 'react-router-dom';
7
- import { Provider as ReduxProvider } from 'react-redux';
8
-
9
- import reducers from '../reducers/index';
10
- import * as AppPropTypes from '../lib/PropTypes';
11
- import { KeysProvider } from '../contexts/KeysContext';
12
-
13
- import App from './App';
14
-
15
- const propTypes = {
16
- locale: PropTypes.string,
17
- messages: PropTypes.oneOfType([
18
- PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)),
19
- PropTypes.objectOf(PropTypes.string),
20
- ]),
21
- routes: PropTypes.objectOf(PropTypes.string),
22
- statusCode: AppPropTypes.statusCode,
23
- googleApiKey: PropTypes.string,
24
- };
25
-
26
- const defaultProps = {
27
- locale: 'fr',
28
- messages: {},
29
- routes: {},
30
- statusCode: null,
31
- googleApiKey: null,
32
- };
33
-
34
- const Root = ({ locale, messages, routes, statusCode, googleApiKey }) => {
35
- const store = useMemo(
36
- () =>
37
- createStore(reducers, {
38
- site: {
39
- statusCode,
40
- },
41
- }),
42
- [statusCode],
43
- );
44
- const keys = useMemo(
45
- () => ({
46
- googleApiKey,
47
- }),
48
- [googleApiKey],
49
- );
50
- return (
51
- <ReduxProvider store={store}>
52
- <IntlProvider locale={locale} messages={messages[locale] || messages}>
53
- <BrowserRouter>
54
- <UrlGeneratorProvider routes={routes}>
55
- <KeysProvider keys={keys}>
56
- <TrackingContainer>
57
- <App />
58
- </TrackingContainer>
59
- </KeysProvider>
60
- </UrlGeneratorProvider>
61
- </BrowserRouter>
62
- </IntlProvider>
63
- </ReduxProvider>
64
- );
65
- };
66
-
67
- Root.propTypes = propTypes;
68
- Root.defaultProps = defaultProps;
69
-
70
- export default Root;
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { connect } from 'react-redux';
4
- import { useFonts } from '@folklore/fonts';
5
-
6
- import styles from '<%= getRelativeStylesPath('components/layouts/Main.jsx', 'layouts/main.scss') %>';
7
-
8
- const propTypes = {
9
- children: PropTypes.node.isRequired,
10
- isPrerender: PropTypes.bool,
11
- fonts: PropTypes.shape({
12
- google: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),
13
- custom: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),
14
- }),
15
- };
16
-
17
- const defaultProps = {
18
- isPrerender: false,
19
- fonts: {
20
- google: {
21
- families: ['Open Sans:400,600,700'],
22
- },
23
- custom: {
24
- families: ['Garage Gothic', 'Brandon Grotesque', 'Sina Nova:400,700,400i,700i'],
25
- },
26
- },
27
- };
28
-
29
- const MainLayout = ({ fonts, children, isPrerender }) => {
30
- const { loaded: fontsLoaded } = useFonts(fonts);
31
-
32
- const innerStyle = {
33
- opacity: fontsLoaded || isPrerender ? 1 : 0,
34
- };
35
-
36
- return (
37
- <div className={styles.container}>
38
- <div className={styles.inner} style={innerStyle}>
39
- <div className={styles.content}>{children}</div>
40
- </div>
41
- </div>
42
- );
43
- };
44
-
45
- MainLayout.propTypes = propTypes;
46
- MainLayout.defaultProps = defaultProps;
47
-
48
- const WithStateContainer = connect(({ site }) => ({
49
- isPrerender: site.isPrerender || false,
50
- }))(MainLayout);
51
-
52
- export default WithStateContainer;
@@ -1,60 +0,0 @@
1
- /* eslint-disable react/no-array-index-key */
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
- import { Link } from 'react-router-dom';
6
-
7
- import * as AppPropTypes from '../../lib/PropTypes';
8
- import Label from '../partials/Label';
9
-
10
- import styles from '<%= getRelativeStylesPath('components/menus/Menu.jsx', 'menus/menu.scss') %>';
11
-
12
- const propTypes = {
13
- items: AppPropTypes.menuItems,
14
- className: PropTypes.string,
15
- };
16
-
17
- const defaultProps = {
18
- items: [],
19
- className: null,
20
- };
21
-
22
- const Menu = ({ items, className }) => (
23
- <nav
24
- className={classNames([
25
- styles.container,
26
- {
27
- [className]: className !== null,
28
- },
29
- ])}
30
- >
31
- <ul className={styles.items}>
32
- {items.map(({ label, url, active = false, external = false }, index) => (
33
- <li
34
- className={classNames([
35
- styles.item,
36
- {
37
- [styles.active]: active,
38
- },
39
- ])}
40
- key={`item-${index}`}
41
- >
42
- {external ? (
43
- <a href={url} className={styles.link}>
44
- <Label>{label}</Label>
45
- </a>
46
- ) : (
47
- <Link to={url} className={styles.link}>
48
- <Label>{label}</Label>
49
- </Link>
50
- )}
51
- </li>
52
- ))}
53
- </ul>
54
- </nav>
55
- );
56
-
57
- Menu.propTypes = propTypes;
58
- Menu.defaultProps = defaultProps;
59
-
60
- export default Menu;
@@ -1,36 +0,0 @@
1
- /* eslint-disable react/jsx-props-no-spreading */
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
-
6
- import * as AppPropTypes from '../../lib/PropTypes';
7
- import Label from '../partials/Label';
8
-
9
- import styles from '<%= getRelativeStylesPath('components/messages/Success.jsx', 'messages/success.scss') %>';
10
-
11
- const propTypes = {
12
- children: AppPropTypes.text.isRequired,
13
- className: PropTypes.string,
14
- };
15
-
16
- const defaultProps = {
17
- className: null,
18
- };
19
-
20
- const SuccessMessage = ({ children, className }) => (
21
- <div
22
- className={classNames([
23
- styles.container,
24
- {
25
- [className]: className !== null,
26
- },
27
- ])}
28
- >
29
- <Label>{children}</Label>
30
- </div>
31
- );
32
-
33
- SuccessMessage.propTypes = propTypes;
34
- SuccessMessage.defaultProps = defaultProps;
35
-
36
- export default SuccessMessage;
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- // import PropTypes from 'prop-types';
3
- import { defineMessages, injectIntl } from 'react-intl';
4
-
5
- // import * as AppPropTypes from '../../lib/PropTypes';
6
- import PageMeta from '../partials/PageMeta';
7
-
8
- import styles from '<%= getRelativeStylesPath('components/pages/Home.jsx', 'pages/home.scss') %>';
9
-
10
- const messages = defineMessages({
11
- metaTitle: {
12
- id: 'meta.title',
13
- defaultMessage: 'Title',
14
- },
15
- });
16
-
17
- const propTypes = {
18
- // intl: AppPropTypes.intl.isRequired,
19
- };
20
-
21
- const HomePage = () => (
22
- <div className={styles.container}>
23
- <PageMeta title={messages.metaTitle} />
24
- <div className={styles.logo} />
25
- </div>
26
- );
27
-
28
- HomePage.propTypes = propTypes;
29
-
30
- const WithIntlContainer = injectIntl(HomePage);
31
-
32
- export default WithIntlContainer;
@@ -1,32 +0,0 @@
1
- /* eslint-disable react/jsx-props-no-spreading */
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { FormattedMessage, FormattedHTMLMessage } from 'react-intl';
5
-
6
- import { label as labelPropTypes } from '../../lib/PropTypes';
7
- import { isMessage } from '../../lib/utils';
8
-
9
- const propTypes = {
10
- children: labelPropTypes.isRequired,
11
- isHtml: PropTypes.bool,
12
- values: PropTypes.object, // eslint-disable-line react/forbid-prop-types
13
- };
14
-
15
- const defaultProps = {
16
- isHtml: false,
17
- values: {},
18
- };
19
-
20
- const Label = ({ children, isHtml, values }) => {
21
- const Message = isHtml ? FormattedHTMLMessage : FormattedMessage;
22
- return isMessage(children) ? (
23
- <Message values={values} {...children} />
24
- ) : (
25
- children
26
- )
27
- };
28
-
29
- Label.propTypes = propTypes;
30
- Label.defaultProps = defaultProps;
31
-
32
- export default Label;
@@ -1,32 +0,0 @@
1
- import { SET_SIZE } from '../actions/LayoutActions';
2
-
3
- const initialState = {
4
- size: {
5
- width: window.innerWidth || 0,
6
- height: window.innerHeight || 0,
7
- },
8
- };
9
-
10
- const LayoutReducer = (previousState, action) => {
11
- let state = previousState || initialState;
12
- if (typeof state.hydrated === 'undefined' || !state.hydrated) {
13
- state = {
14
- ...initialState,
15
- ...previousState,
16
- hydrated: true,
17
- };
18
- }
19
- switch (action.type) {
20
- case SET_SIZE:
21
- return {
22
- ...state,
23
- size: {
24
- ...action.payload,
25
- },
26
- };
27
- default:
28
- return state;
29
- }
30
- };
31
-
32
- export default LayoutReducer;
@@ -1,36 +0,0 @@
1
- import { SET_ERRORS, RESET_REQUEST } from '../actions/SiteActions';
2
-
3
- const initialState = {
4
- errors: null,
5
- statusCode: null,
6
- messages: null,
7
- };
8
-
9
- const SiteReducer = (previousState, action) => {
10
- let state = previousState || initialState;
11
- if (typeof state.hydrated === 'undefined' || !state.hydrated) {
12
- state = {
13
- ...initialState,
14
- ...previousState,
15
- hydrated: true,
16
- };
17
- }
18
- switch (action.type) {
19
- case SET_ERRORS:
20
- return {
21
- ...state,
22
- errors: action.payload,
23
- };
24
- case RESET_REQUEST:
25
- return {
26
- ...state,
27
- errors: null,
28
- statusCode: null,
29
- messages: null,
30
- };
31
- default:
32
- return state;
33
- }
34
- };
35
-
36
- export default SiteReducer;
@@ -1,7 +0,0 @@
1
- import SiteReducer from './SiteReducer';
2
- import LayoutReducer from './LayoutReducer';
3
-
4
- export default {
5
- site: SiteReducer,
6
- layout: LayoutReducer,
7
- };
@@ -1,2 +0,0 @@
1
- import 'intl';
2
- import 'intl/locale-data/jsonp/en';
@@ -1,2 +0,0 @@
1
- import 'intl';
2
- import 'intl/locale-data/jsonp/fr';
@@ -1,6 +0,0 @@
1
- {
2
- "require": {
3
- "folklore/laravel-mediatheque": "v1.x-dev",
4
- "folklore/laravel-panneau": "v1.x-dev"
5
- }
6
- }
@@ -1,11 +0,0 @@
1
- {
2
- "scripts": {
3
- "build:panneau": "node ./build/scripts/build.js --config ./resources/assets/vendor/panneau/webpack.config.js",
4
- "build:site": "node ./build/scripts/build.js --config ./build/webpack.config.prod.js",
5
- "build": "node ./build/scripts/build.js --config ./resources/assets/vendor/panneau/webpack.config.js --config ./build/webpack.config.prod.js",
6
- "server:panneau": "node ./build/scripts/server.js --config ./resources/assets/vendor/panneau/webpack.config.js",
7
- "server:site": "node ./build/scripts/server.js --config ./build/webpack.config.dev.js",
8
- "server": "node ./build/scripts/server.js --config ./resources/assets/vendor/panneau/webpack.config.js --config ./build/webpack.config.dev.js",
9
- "start": "npm run server"
10
- }
11
- }
@@ -1,14 +0,0 @@
1
- <?php
2
-
3
- namespace App\Http\Controllers\Panneau;
4
-
5
- use Illuminate\Http\Request;
6
- use Folklore\Panneau\Http\Controllers\HomeController as BaseHomeController;
7
-
8
- class HomeController extends BaseHomeController
9
- {
10
- public function index(Request $request)
11
- {
12
- return redirect()->route('panneau.resource.index', ['pages']);
13
- }
14
- }
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- namespace App\Http\Controllers\Panneau;
4
-
5
- use Folklore\Panneau\Http\Controllers\PagesController as BasePagesController;
6
- use Illuminate\Http\Request;
7
-
8
- class PagesController extends BasePagesController
9
- {
10
-
11
- }
@@ -1,13 +0,0 @@
1
- <?php
2
-
3
- namespace App\Models\Mediatheque;
4
-
5
- use Folklore\Mediatheque\Models\File as BaseFile;
6
-
7
- class File extends BaseFile
8
- {
9
- protected $hidden = [
10
- 'pivot',
11
- 'path'
12
- ];
13
- }
@@ -1,13 +0,0 @@
1
- <?php
2
-
3
- namespace App\Models\Mediatheque;
4
-
5
- use Folklore\Mediatheque\Models\Picture as BasePicture;
6
-
7
- class Picture extends BasePicture
8
- {
9
- protected $hidden = [
10
- 'files',
11
- 'pivot',
12
- ];
13
- }
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- namespace App\Models\Mediatheque;
4
-
5
- use Folklore\Mediatheque\Models\Video as BaseVideo;
6
-
7
- class Video extends BaseVideo
8
- {
9
- protected $hidden = [
10
- 'pivot',
11
- ];
12
-
13
- protected $appends = [
14
- 'original_file',
15
- 'thumbnails',
16
- 'url',
17
- 'duration_human',
18
- 'type',
19
- 'mp4_url',
20
- 'thumbnail'
21
- ];
22
-
23
- protected function getMp4UrlAttribute()
24
- {
25
- $mp4 = $this->files->mp4;
26
- return !is_null($mp4) ? $mp4->url : $this->url;
27
- }
28
-
29
- protected function getThumbnailAttribute()
30
- {
31
- $thumbnails = $this->getThumbnails();
32
- return sizeof($thumbnails) ? image()->url($thumbnails[0]->getUrl(), ['thumbnail']) : null;
33
- }
34
- }
@@ -1,23 +0,0 @@
1
- <?php
2
-
3
- namespace App\Providers;
4
-
5
- use Illuminate\Support\Facades\Schema;
6
- use Illuminate\Support\ServiceProvider;
7
-
8
- class PanneauServiceProvider extends ServiceProvider
9
- {
10
- /**
11
- * Register any application services.
12
- *
13
- * @return void
14
- */
15
- public function register()
16
- {
17
- $this->app->bind(\Folklore\Panneau\Contracts\Page::class, \App\Models\Page::class);
18
- $this->app->bind(\Folklore\Panneau\Contracts\Block::class, \App\Models\Block::class);
19
- $this->app->bind(\Folklore\Mediatheque\Contracts\Models\Video::class, \App\Models\Mediatheque\Video::class);
20
- $this->app->bind(\Folklore\Mediatheque\Contracts\Models\Picture::class, \App\Models\Mediatheque\Picture::class);
21
- $this->app->bind(\Folklore\Mediatheque\Contracts\Models\File::class, \App\Models\Mediatheque\File::class);
22
- }
23
- }