@kaspernj/api-maker 1.0.2011 → 1.0.2012
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{.eslintrc.cjs → .eslintrc.js} +10 -1
- package/README.md +35 -0
- package/android/build.gradle +43 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/expo/modules/api_maker/ApiMakerModule.kt +50 -0
- package/android/src/main/java/expo/modules/api_maker/ApiMakerView.kt +30 -0
- package/build/api.js +120 -0
- package/build/attribute-not-loaded-error.js +2 -0
- package/build/base-component.js +5 -0
- package/build/base-error.js +33 -0
- package/build/base-model/attribute.js +25 -0
- package/build/base-model/column.js +11 -0
- package/build/base-model/reflection.js +14 -0
- package/build/base-model/scope.js +11 -0
- package/build/base-model.js +828 -0
- package/build/bootstrap/attribute-row.js +135 -0
- package/build/bootstrap/attribute-rows.js +31 -0
- package/build/bootstrap/card.js +138 -0
- package/build/bootstrap/checkbox.js +97 -0
- package/build/bootstrap/checkboxes.js +183 -0
- package/build/bootstrap/index.js +2 -0
- package/build/bootstrap/input.js +129 -0
- package/build/bootstrap/invalid-feedback.js +27 -0
- package/build/bootstrap/paginate.js +150 -0
- package/build/bootstrap/radio-buttons.js +72 -0
- package/build/bootstrap/select.js +88 -0
- package/build/bootstrap/sort-link.js +131 -0
- package/build/cable-connection-pool.js +128 -0
- package/build/cable-subscription-pool.js +207 -0
- package/build/cable-subscription.js +21 -0
- package/build/cache-key-generator.js +81 -0
- package/build/can-can.js +134 -0
- package/build/channels-consumer.js +9 -0
- package/build/collection-loader.js +48 -0
- package/build/collection.js +280 -0
- package/build/command-submit-data.js +81 -0
- package/build/commands-pool.js +195 -0
- package/build/compose.js +9 -0
- package/build/config.js +62 -0
- package/build/custom-error.js +5 -0
- package/build/data-set-to-attributes.js +10 -0
- package/build/deserializer.js +56 -0
- package/build/destroy-error.js +5 -0
- package/build/devise.js +112 -0
- package/build/draggable-sort/controller.js +136 -0
- package/build/draggable-sort/index.js +114 -0
- package/build/draggable-sort/item.js +188 -0
- package/build/error-logger.js +101 -0
- package/build/error-messages.js +13 -0
- package/build/event-connection.js +32 -0
- package/build/event-emitter-listener.js +15 -0
- package/build/event-model-class.js +24 -0
- package/build/events.js +5 -0
- package/build/flash-message.js +79 -0
- package/build/form.js +83 -0
- package/build/history-expo.js +20 -0
- package/build/history-react-native.js +20 -0
- package/build/history.js +3 -0
- package/build/index.js +3 -0
- package/build/inputs/attachment.js +133 -0
- package/build/inputs/auto-submit.js +36 -0
- package/build/inputs/checkbox.js +138 -0
- package/build/inputs/checkboxes.js +112 -0
- package/build/inputs/id-for-component.js +15 -0
- package/build/inputs/input-wrapper.js +19 -0
- package/build/inputs/input.js +243 -0
- package/build/inputs/money.js +179 -0
- package/build/inputs/name-for-component.js +13 -0
- package/build/inputs/select.js +93 -0
- package/build/instance-of-class-name.js +23 -0
- package/build/key-value-store.js +53 -0
- package/build/link.js +73 -0
- package/build/logger.js +30 -0
- package/build/modal.js +38 -0
- package/build/model-class-require.js +13 -0
- package/build/model-events.js +30 -0
- package/build/model-name.js +28 -0
- package/build/model-prop-type.js +101 -0
- package/build/model-recipes-loader.js +32 -0
- package/build/model-recipes-model-loader.js +357 -0
- package/build/models-response-reader.js +40 -0
- package/build/models.js +8 -0
- package/build/money-formatter.js +78 -0
- package/build/not-loaded-error.js +2 -0
- package/build/params.js +61 -0
- package/build/preloaded.js +38 -0
- package/build/resize-observer.js +11 -0
- package/build/result.js +13 -0
- package/build/router/route.js +270 -0
- package/build/router/switch.js +72 -0
- package/build/router.js +59 -0
- package/build/routes-native.js +202 -0
- package/build/routes.js +50 -0
- package/build/run-last.js +35 -0
- package/build/serializer.js +63 -0
- package/build/services.js +20 -0
- package/build/session-status-updater.js +134 -0
- package/build/source-maps-loader.js +184 -0
- package/build/super-admin/config-reader.js +85 -0
- package/build/super-admin/edit-page/edit-attribute-checkbox.js +85 -0
- package/build/super-admin/edit-page/edit-attribute-content.js +55 -0
- package/build/super-admin/edit-page/edit-attribute-input.js +79 -0
- package/build/super-admin/edit-page/edit-attribute.js +77 -0
- package/build/super-admin/edit-page.js +123 -0
- package/build/super-admin/has-edit-config.js +12 -0
- package/build/super-admin/index-page.js +25 -0
- package/build/super-admin/index.js +181 -0
- package/build/super-admin/layout/header/index.js +161 -0
- package/build/super-admin/layout/index.js +164 -0
- package/build/super-admin/layout/menu/index.js +206 -0
- package/build/super-admin/layout/menu/menu-content.js +46 -0
- package/build/super-admin/layout/menu/menu-item.js +84 -0
- package/build/super-admin/layout/no-access.js +27 -0
- package/build/super-admin/model-class-table.js +61 -0
- package/build/super-admin/models.js +8 -0
- package/build/super-admin/show-nav.js +51 -0
- package/build/super-admin/show-page/belongs-to-attribute-row.js +29 -0
- package/build/super-admin/show-page/index.js +141 -0
- package/build/super-admin/show-reflection-actions.js +47 -0
- package/build/super-admin/show-reflection-link.js +48 -0
- package/build/super-admin/show-reflection-page.js +48 -0
- package/build/table/column-content.js +117 -0
- package/build/table/column-identifier.js +18 -0
- package/build/table/column-visible.js +7 -0
- package/build/table/components/column.js +21 -0
- package/build/table/components/flat-list.js +21 -0
- package/build/table/components/header.js +26 -0
- package/build/table/components/row.js +26 -0
- package/build/table/filters/attribute-element.js +44 -0
- package/build/table/filters/filter-form.js +402 -0
- package/build/table/filters/filter.js +90 -0
- package/build/table/filters/index.js +184 -0
- package/build/table/filters/load-search-modal.js +175 -0
- package/build/table/filters/reflection-element.js +37 -0
- package/build/table/filters/save-search-modal.js +88 -0
- package/build/table/filters/scope-element.js +42 -0
- package/build/table/header-column-content.js +68 -0
- package/build/table/header-column.js +144 -0
- package/build/table/header-select.js +105 -0
- package/build/table/model-callback-args.js +10 -0
- package/build/table/model-column.js +97 -0
- package/build/table/model-row.js +193 -0
- package/build/table/select-calculator.js +63 -0
- package/build/table/settings/column-row.js +97 -0
- package/build/table/settings/download-action.js +79 -0
- package/build/table/settings/index.js +92 -0
- package/build/table/table-settings.js +219 -0
- package/build/table/table.js +972 -0
- package/build/table/use-sorting.js +34 -0
- package/build/table/widths.js +75 -0
- package/build/table/worker-plugins-check-all-checkbox.js +125 -0
- package/build/table/worker-plugins-checkbox.js +115 -0
- package/build/translated-attributes.js +10 -0
- package/build/translated-collections.js +12 -0
- package/build/updated-attribute.js +76 -0
- package/build/url-encode.js +15 -0
- package/build/use-breakpoint.js +62 -0
- package/build/use-can-can.js +55 -0
- package/build/use-collection.js +225 -0
- package/build/use-created-event.js +52 -0
- package/build/use-current-user.js +76 -0
- package/build/use-destroyed-event.js +60 -0
- package/build/use-event-emitter.js +13 -0
- package/build/use-event-listener.js +16 -0
- package/build/use-input.js +137 -0
- package/build/use-model-event.js +60 -0
- package/build/use-model.js +169 -0
- package/build/use-resize-observer.js +23 -0
- package/build/use-router.js +104 -0
- package/build/use-screen-layout.js +39 -0
- package/build/use-updated-event.js +60 -0
- package/build/use-validation-errors.js +30 -0
- package/build/utils/card.js +51 -0
- package/build/utils/checkbox.js +78 -0
- package/build/utils/checkboxes.js +163 -0
- package/build/utils/default-style.js +18 -0
- package/build/utils/icon.js +23 -0
- package/build/utils/invalid-feedback.js +19 -0
- package/build/utils/modal.js +62 -0
- package/build/utils/text.js +19 -0
- package/build/validation-error.js +28 -0
- package/build/validation-errors.js +98 -0
- package/build/with-api-maker.js +29 -0
- package/build/with-collection.js +14 -0
- package/build/with-current-user.js +10 -0
- package/build/with-model.js +15 -0
- package/build/with-router.js +22 -0
- package/expo-module.config.json +17 -0
- package/ios/ApiMaker.podspec +29 -0
- package/ios/ApiMakerModule.swift +48 -0
- package/ios/ApiMakerView.swift +38 -0
- package/link.sh +8 -0
- package/package.json +49 -46
- package/src/{api.mjs → api.js} +38 -37
- package/src/base-component.jsx +5 -0
- package/src/{base-error.mjs → base-error.js} +4 -6
- package/src/base-model/attribute.js +33 -0
- package/src/base-model/column.js +13 -0
- package/src/base-model/reflection.js +15 -0
- package/src/base-model/scope.js +12 -0
- package/src/{base-model.mjs → base-model.js} +302 -144
- package/src/bootstrap/attribute-row.jsx +135 -0
- package/src/bootstrap/attribute-rows.jsx +27 -0
- package/src/bootstrap/card.jsx +149 -0
- package/src/bootstrap/checkbox.jsx +86 -0
- package/src/bootstrap/checkboxes.jsx +185 -0
- package/src/bootstrap/index.js +0 -0
- package/src/bootstrap/input.jsx +173 -0
- package/src/bootstrap/invalid-feedback.jsx +31 -0
- package/src/bootstrap/paginate.jsx +187 -0
- package/src/bootstrap/radio-buttons.jsx +87 -0
- package/src/bootstrap/select.jsx +110 -0
- package/src/bootstrap/sort-link.jsx +106 -0
- package/src/{cable-connection-pool.mjs → cable-connection-pool.js} +16 -36
- package/src/{cable-subscription-pool.mjs → cable-subscription-pool.js} +26 -21
- package/src/{cable-subscription.mjs → cable-subscription.js} +6 -4
- package/src/cache-key-generator.js +100 -0
- package/src/{can-can.mjs → can-can.js} +13 -12
- package/src/channels-consumer.js +10 -0
- package/src/collection-loader.jsx +58 -224
- package/src/{collection.mjs → collection.js} +98 -44
- package/src/{command-submit-data.mjs → command-submit-data.js} +2 -7
- package/src/{commands-pool.mjs → commands-pool.js} +57 -41
- package/src/compose.js +11 -0
- package/src/{config.mjs → config.js} +6 -2
- package/src/{custom-error.mjs → custom-error.js} +1 -1
- package/src/data-set-to-attributes.js +13 -0
- package/src/{deserializer.mjs → deserializer.js} +3 -3
- package/src/destroy-error.js +7 -0
- package/src/devise.js +129 -0
- package/src/draggable-sort/controller.js +137 -0
- package/src/draggable-sort/index.jsx +108 -0
- package/src/draggable-sort/item.jsx +174 -0
- package/src/{error-logger.mjs → error-logger.js} +12 -7
- package/src/{error-messages.mjs → error-messages.js} +1 -0
- package/src/event-connection.jsx +1 -1
- package/src/event-emitter-listener.jsx +8 -27
- package/src/event-model-class.jsx +2 -4
- package/src/events.js +7 -0
- package/src/flash-message.js +70 -0
- package/src/form.jsx +91 -0
- package/src/history-expo.js +23 -0
- package/src/history-react-native.js +25 -0
- package/src/history.js +3 -0
- package/src/index.js +3 -0
- package/src/inputs/attachment.jsx +108 -0
- package/src/inputs/auto-submit.js +37 -0
- package/src/inputs/checkbox.jsx +125 -0
- package/src/inputs/checkboxes.jsx +116 -0
- package/src/inputs/id-for-component.js +15 -0
- package/src/inputs/input-wrapper.jsx +16 -0
- package/src/inputs/input.jsx +260 -0
- package/src/inputs/money.jsx +187 -0
- package/src/inputs/name-for-component.js +15 -0
- package/src/inputs/select.jsx +104 -0
- package/src/{key-value-store.mjs → key-value-store.js} +1 -1
- package/src/link.jsx +54 -9
- package/src/logger.js +38 -0
- package/src/modal.jsx +37 -0
- package/src/model-class-require.js +17 -0
- package/src/{model-events.mjs → model-events.js} +1 -1
- package/src/{model-name.mjs → model-name.js} +8 -8
- package/src/{model-recipes-loader.mjs → model-recipes-loader.js} +1 -1
- package/src/{model-recipes-model-loader.mjs → model-recipes-model-loader.js} +5 -5
- package/src/{models-response-reader.mjs → models-response-reader.js} +3 -4
- package/src/models.js +7 -0
- package/src/{models.mjs.erb → models.js.erb} +6 -3
- package/src/{money-formatter.mjs → money-formatter.js} +5 -4
- package/src/{params.mjs → params.js} +17 -7
- package/src/{preloaded.mjs → preloaded.js} +2 -2
- package/src/resize-observer.jsx +10 -0
- package/src/result.js +13 -0
- package/src/router/route.jsx +246 -0
- package/src/router/switch.jsx +76 -0
- package/src/router.jsx +23 -21
- package/src/{routes-native.mjs → routes-native.js} +12 -6
- package/src/{routes.mjs → routes.js} +1 -1
- package/src/run-last.js +39 -0
- package/src/{serializer.mjs → serializer.js} +2 -2
- package/src/{services.mjs → services.js} +1 -1
- package/src/session-status-updater.js +172 -0
- package/src/{source-maps-loader.mjs → source-maps-loader.js} +54 -28
- package/src/super-admin/config-reader.jsx +93 -0
- package/src/super-admin/edit-page/edit-attribute-checkbox.jsx +81 -0
- package/src/super-admin/edit-page/edit-attribute-content.jsx +57 -0
- package/src/super-admin/edit-page/edit-attribute-input.jsx +71 -0
- package/src/super-admin/edit-page/edit-attribute.jsx +81 -0
- package/src/super-admin/edit-page.jsx +117 -0
- package/src/super-admin/has-edit-config.js +15 -0
- package/src/super-admin/index-page.jsx +23 -0
- package/src/super-admin/index.jsx +197 -0
- package/src/super-admin/layout/header/index.jsx +144 -0
- package/src/super-admin/layout/header/style.scss +45 -0
- package/src/super-admin/layout/index.jsx +154 -0
- package/src/super-admin/layout/menu/index.jsx +171 -0
- package/src/super-admin/layout/menu/menu-content.jsx +43 -0
- package/src/super-admin/layout/menu/menu-item.jsx +70 -0
- package/src/super-admin/layout/menu/style.scss +11 -0
- package/src/super-admin/layout/no-access.jsx +26 -0
- package/src/super-admin/model-class-table.jsx +66 -0
- package/src/super-admin/models.js +11 -0
- package/src/super-admin/show-nav.jsx +44 -0
- package/src/super-admin/show-page/belongs-to-attribute-row.jsx +30 -0
- package/src/super-admin/show-page/index.jsx +141 -0
- package/src/super-admin/show-reflection-actions.jsx +49 -0
- package/src/super-admin/show-reflection-link.jsx +40 -0
- package/src/super-admin/show-reflection-page.jsx +47 -0
- package/src/super-admin/stylesheets/variables.scss +11 -0
- package/src/table/column-content.jsx +122 -0
- package/src/table/column-identifier.js +23 -0
- package/src/table/column-visible.js +7 -0
- package/src/table/components/column.jsx +19 -0
- package/src/table/components/flat-list.jsx +19 -0
- package/src/table/components/header.jsx +21 -0
- package/src/table/components/row.jsx +23 -0
- package/src/table/filters/attribute-element.jsx +47 -0
- package/src/table/filters/filter-form.jsx +407 -0
- package/src/table/filters/filter.jsx +70 -0
- package/src/table/filters/index.jsx +170 -0
- package/src/table/filters/load-search-modal.jsx +146 -0
- package/src/table/filters/reflection-element.jsx +38 -0
- package/src/table/filters/save-search-modal.jsx +74 -0
- package/src/table/filters/scope-element.jsx +44 -0
- package/src/table/header-column-content.jsx +55 -0
- package/src/table/header-column.jsx +129 -0
- package/src/table/header-select.jsx +73 -0
- package/src/table/model-callback-args.js +10 -0
- package/src/table/model-column.jsx +82 -0
- package/src/table/model-row.jsx +136 -0
- package/src/table/select-calculator.js +65 -0
- package/src/table/settings/column-row.jsx +93 -0
- package/src/table/settings/download-action.jsx +68 -0
- package/src/table/settings/index.jsx +65 -0
- package/src/table/table-settings.js +263 -0
- package/src/table/table.jsx +950 -0
- package/src/table/use-sorting.js +35 -0
- package/src/table/variables.scss +11 -0
- package/src/table/widths.jsx +87 -0
- package/src/table/worker-plugins-check-all-checkbox.jsx +112 -0
- package/src/table/worker-plugins-checkbox.jsx +104 -0
- package/src/translated-attributes.js +11 -0
- package/src/{translated-collections.mjs → translated-collections.js} +3 -2
- package/src/updated-attribute.jsx +1 -1
- package/src/url-encode.js +18 -0
- package/src/use-breakpoint.js +76 -0
- package/src/use-can-can.js +55 -0
- package/src/use-collection.js +280 -0
- package/src/use-created-event.js +55 -0
- package/src/use-current-user.js +88 -0
- package/src/use-destroyed-event.js +60 -0
- package/src/use-event-emitter.js +15 -0
- package/src/use-event-listener.js +19 -0
- package/src/use-input.js +157 -0
- package/src/use-model-event.js +60 -0
- package/src/use-model.js +189 -0
- package/src/use-resize-observer.js +24 -0
- package/src/use-router.jsx +128 -0
- package/src/use-screen-layout.js +49 -0
- package/src/use-updated-event.js +60 -0
- package/src/use-validation-errors.js +33 -0
- package/src/utils/card.jsx +49 -0
- package/src/utils/checkbox.jsx +80 -0
- package/src/utils/checkboxes.jsx +158 -0
- package/src/utils/default-style.jsx +25 -0
- package/src/utils/icon.jsx +21 -0
- package/src/utils/invalid-feedback.jsx +20 -0
- package/src/utils/modal.jsx +60 -0
- package/src/utils/text.jsx +16 -0
- package/src/{validation-error.mjs → validation-error.js} +9 -5
- package/src/{validation-errors.mjs → validation-errors.js} +15 -27
- package/src/with-api-maker.jsx +31 -0
- package/src/with-collection.jsx +17 -0
- package/src/with-current-user.jsx +7 -25
- package/src/with-model.jsx +16 -0
- package/src/with-router.jsx +7 -129
- package/__tests__/base-model.test.js +0 -71
- package/__tests__/cable-connection-pool.test.js +0 -227
- package/__tests__/cable-subscription-pool.test.js +0 -26
- package/__tests__/can-can.test.js +0 -34
- package/__tests__/collection.test.js +0 -51
- package/__tests__/custom-error.test.js +0 -13
- package/__tests__/model-name.test.js +0 -34
- package/__tests__/model-prop-type.test.js +0 -113
- package/__tests__/params.test.js +0 -40
- package/__tests__/routes-native.test.js +0 -103
- package/__tests__/routes.test.js +0 -46
- package/__tests__/serializer.test.js +0 -30
- package/__tests__/support/task.js +0 -27
- package/__tests__/support/user.js +0 -32
- package/index.js +0 -1
- package/jest.config.js +0 -4
- package/src/can-can-loader.jsx +0 -54
- package/src/channels-consumer.mjs +0 -3
- package/src/destroy-error.mjs +0 -7
- package/src/devise.mjs +0 -122
- package/src/event-created.jsx +0 -65
- package/src/event-destroyed.jsx +0 -29
- package/src/event-listener.jsx +0 -38
- package/src/event-updated.jsx +0 -74
- package/src/logger.mjs +0 -25
- package/src/model-class-require.mjs +0 -10
- package/src/model-load-wrapper.jsx +0 -116
- package/src/result.mjs +0 -29
- package/src/session-status-updater.mjs +0 -116
- package/webpack.config.js +0 -15
- /package/src/{attribute-not-loaded-error.mjs → attribute-not-loaded-error.js} +0 -0
- /package/src/{instance-of-class-name.mjs → instance-of-class-name.js} +0 -0
- /package/src/{model-prop-type.mjs → model-prop-type.js} +0 -0
- /package/src/{not-loaded-error.mjs → not-loaded-error.js} +0 -0
- /package/src/{translated-collections-data.mjs.erb → translated-collections-data.js.erb} +0 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// import "../../../../src/super-admin/layout/header/style"
|
|
2
|
+
import React, {useRef} from "react"
|
|
3
|
+
import BaseComponent from "../../../base-component"
|
|
4
|
+
import Icon from "../../../utils/icon"
|
|
5
|
+
import memo from "set-state-compare/src/memo"
|
|
6
|
+
import PropTypes from "prop-types"
|
|
7
|
+
import PropTypesExact from "prop-types-exact"
|
|
8
|
+
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
9
|
+
import Text from "../../../utils/text"
|
|
10
|
+
import {Pressable, View} from "react-native"
|
|
11
|
+
import useBreakpoint from "../../../use-breakpoint"
|
|
12
|
+
import useEventListener from "../../../use-event-listener"
|
|
13
|
+
|
|
14
|
+
export default memo(shapeComponent(class ApiMakerSuperAdminLayoutHeader extends BaseComponent {
|
|
15
|
+
static propTypes = PropTypesExact({
|
|
16
|
+
actions: PropTypes.node,
|
|
17
|
+
onTriggerMenu: PropTypes.func.isRequired,
|
|
18
|
+
title: PropTypes.string
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
setup() {
|
|
22
|
+
const {name: breakpoint, mdUp} = useBreakpoint()
|
|
23
|
+
|
|
24
|
+
this.headerActionsRef = useRef()
|
|
25
|
+
this.setInstance({breakpoint, mdUp})
|
|
26
|
+
this.useStates({
|
|
27
|
+
headerActionsActive: false
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
useEventListener(window, "mouseup", this.tt.onWindowMouseUp)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
const {breakpoint, mdUp} = this.tt
|
|
35
|
+
const {actions, onTriggerMenu, title} = this.props
|
|
36
|
+
|
|
37
|
+
const headerStyle = {
|
|
38
|
+
display: "flex",
|
|
39
|
+
flexDirection: "row",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
zIndex: 9,
|
|
42
|
+
height: 100,
|
|
43
|
+
paddingRight: 30,
|
|
44
|
+
paddingLeft: 30,
|
|
45
|
+
backgroundColor: "#fff"
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const headerActionsContainerStyle = {}
|
|
49
|
+
const headerActionsStyle = {}
|
|
50
|
+
|
|
51
|
+
if (breakpoint == "xs" || breakpoint == "sm") {
|
|
52
|
+
headerStyle.position = "absolute"
|
|
53
|
+
headerStyle.width = "100%"
|
|
54
|
+
|
|
55
|
+
Object.assign(headerActionsContainerStyle, {
|
|
56
|
+
position: "fixed",
|
|
57
|
+
top: 0,
|
|
58
|
+
left: 0,
|
|
59
|
+
|
|
60
|
+
display: "flex",
|
|
61
|
+
width: "100vw",
|
|
62
|
+
height: "100vh",
|
|
63
|
+
alignItems: "center",
|
|
64
|
+
justifyContent: "center",
|
|
65
|
+
|
|
66
|
+
background: "rgba(#000, .8)"
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
if (!this.s.headerActionsActive) {
|
|
70
|
+
headerActionsContainerStyle.display = "none"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
Object.assign(headerActionsStyle, {
|
|
74
|
+
minWidth: "80vw",
|
|
75
|
+
maxWidth: "100vw",
|
|
76
|
+
backgroundColor: "#fff"
|
|
77
|
+
})
|
|
78
|
+
} else if (breakpoint == "md") {
|
|
79
|
+
headerStyle.position = "fixed"
|
|
80
|
+
headerStyle.left = 250
|
|
81
|
+
headerStyle.width = "calc(100% - 250px)"
|
|
82
|
+
} else if (breakpoint == "lg" || breakpoint == "xl" || breakpoint == "xxl") {
|
|
83
|
+
headerStyle.position = "fixed"
|
|
84
|
+
headerStyle.left = 290
|
|
85
|
+
headerStyle.width = "calc(100% - 290px)"
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (breakpoint == "md" || breakpoint == "lg" || breakpoint == "xl" || breakpoint == "xxl") {
|
|
89
|
+
headerActionsContainerStyle.marginLeft = "auto"
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<View dataSet={{component: "super-admin--layout--header"}} style={headerStyle}>
|
|
94
|
+
<View dataSet={{class: "header-title-container"}}>
|
|
95
|
+
<Text style={{color: "#282a33", fontSize: 22}}>
|
|
96
|
+
{title}
|
|
97
|
+
</Text>
|
|
98
|
+
</View>
|
|
99
|
+
{actions &&
|
|
100
|
+
<View dataSet={{active: this.s.headerActionsActive, class: "header-actions-container"}} style={headerActionsContainerStyle}>
|
|
101
|
+
<View
|
|
102
|
+
dataSet={{class: "header-actions"}}
|
|
103
|
+
ref={this.tt.headerActionsRef}
|
|
104
|
+
style={headerActionsStyle}
|
|
105
|
+
>
|
|
106
|
+
{actions}
|
|
107
|
+
</View>
|
|
108
|
+
</View>
|
|
109
|
+
}
|
|
110
|
+
{!mdUp &&
|
|
111
|
+
<View
|
|
112
|
+
dataSet={{class: "burger-menu-container"}}
|
|
113
|
+
style={{
|
|
114
|
+
flexDirection: "row",
|
|
115
|
+
marginLeft: "auto"
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
{actions &&
|
|
119
|
+
<Pressable dataSet={{class: "actions-link"}} onPress={this.tt.onGearsClicked} style={{marginRight: 8, fontSize: 22}}>
|
|
120
|
+
<Icon name="gear" size={20} />
|
|
121
|
+
</Pressable>
|
|
122
|
+
}
|
|
123
|
+
<Pressable dataSet={{class: "burger-menu-link"}} onPress={onTriggerMenu}>
|
|
124
|
+
<Icon name="bars" size={20} />
|
|
125
|
+
</Pressable>
|
|
126
|
+
</View>
|
|
127
|
+
}
|
|
128
|
+
</View>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
onGearsClicked = () => {
|
|
133
|
+
console.log("onGearsClicked")
|
|
134
|
+
|
|
135
|
+
this.setState({headerActionsActive: !this.s.headerActionsActive})
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
onWindowMouseUp = (e) => {
|
|
139
|
+
// Close the header actions menu if clicked happened outside
|
|
140
|
+
if (this.s.headerActionsActive && this.tt.headerActionsRef.current && !this.tt.headerActionsRef.current.contains(e.target)) {
|
|
141
|
+
this.setState({headerActionsActive: false})
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}))
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@use "@kaspernj/api-maker/src/super-admin/stylesheets/variables" as *;
|
|
2
|
+
|
|
3
|
+
[data-component="super-admin--layout--header"] {
|
|
4
|
+
@media (max-width: $sm-to) {
|
|
5
|
+
[data-class="header-actions"] {
|
|
6
|
+
.action-button {
|
|
7
|
+
display: block;
|
|
8
|
+
padding: 11px;
|
|
9
|
+
|
|
10
|
+
+ .action-button {
|
|
11
|
+
border-top: 1px solid #c9c9c9;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&:link,
|
|
15
|
+
&:visited {
|
|
16
|
+
color: #000;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:active,
|
|
20
|
+
&:hover {
|
|
21
|
+
background: #dddcf0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media (min-width: $md-from) {
|
|
28
|
+
[data-class="header-actions"] {
|
|
29
|
+
.action-button {
|
|
30
|
+
display: inline-block;
|
|
31
|
+
padding: 7px 10px;
|
|
32
|
+
border: 1px solid #cbd5e1;
|
|
33
|
+
margin-right: 4px;
|
|
34
|
+
margin-bottom: 4px;
|
|
35
|
+
border-radius: 5px;
|
|
36
|
+
font-size: 13px;
|
|
37
|
+
|
|
38
|
+
&:link,
|
|
39
|
+
&:visited {
|
|
40
|
+
color: #000;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import React, {useMemo} from "react"
|
|
2
|
+
import {StyleSheet, View} from "react-native"
|
|
3
|
+
import BaseComponent from "../../base-component"
|
|
4
|
+
import CommandsPool from "../../commands-pool"
|
|
5
|
+
import config from "super-admin/config"
|
|
6
|
+
import Header from "./header"
|
|
7
|
+
import memo from "set-state-compare/src/memo"
|
|
8
|
+
import Menu from "./menu"
|
|
9
|
+
import PropTypes from "prop-types"
|
|
10
|
+
import PropTypesExact from "prop-types-exact"
|
|
11
|
+
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
12
|
+
import Text from "../../utils/text"
|
|
13
|
+
import useBreakpoint from "../../use-breakpoint"
|
|
14
|
+
import useCurrentUser from "../../use-current-user"
|
|
15
|
+
import useI18n from "i18n-on-steroids/src/use-i18n"
|
|
16
|
+
|
|
17
|
+
const NoAccess = React.lazy(() => import("./no-access"))
|
|
18
|
+
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
appLayoutContentContainer: {
|
|
21
|
+
base: {
|
|
22
|
+
minHeight: "100vh",
|
|
23
|
+
backgroundColor: "#f7f7f7"
|
|
24
|
+
},
|
|
25
|
+
mdDown: {
|
|
26
|
+
paddingTop: 130,
|
|
27
|
+
paddingRight: 30,
|
|
28
|
+
paddingBottom: 30
|
|
29
|
+
},
|
|
30
|
+
mdUp: {
|
|
31
|
+
paddingTop: 130,
|
|
32
|
+
paddingRight: 30,
|
|
33
|
+
paddingBottom: 30,
|
|
34
|
+
paddingLeft: 280
|
|
35
|
+
},
|
|
36
|
+
lgUp: {
|
|
37
|
+
paddingTop: 130,
|
|
38
|
+
paddingRight: 30,
|
|
39
|
+
paddingBottom: 30,
|
|
40
|
+
paddingLeft: 320
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
mb15: {
|
|
44
|
+
marginBottom: 15
|
|
45
|
+
},
|
|
46
|
+
rootView: {
|
|
47
|
+
width: "100%",
|
|
48
|
+
minHeight: "100vh",
|
|
49
|
+
backgroundColor: "#fff",
|
|
50
|
+
color: "#000"
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
export default memo(shapeComponent(class ApiMakerSuperAdminLayout extends BaseComponent {
|
|
55
|
+
static propTypes = PropTypesExact({
|
|
56
|
+
actions: PropTypes.node,
|
|
57
|
+
active: PropTypes.string,
|
|
58
|
+
children: PropTypes.node,
|
|
59
|
+
className: PropTypes.string,
|
|
60
|
+
currentCustomer: PropTypes.object,
|
|
61
|
+
currentCustomerId: PropTypes.string,
|
|
62
|
+
currentUser: PropTypes.object,
|
|
63
|
+
headTitle: PropTypes.string,
|
|
64
|
+
headerTitle: PropTypes.string
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
setup() {
|
|
68
|
+
const currentUser = useCurrentUser()
|
|
69
|
+
const {locale, t} = useI18n({namespace: "js.api_maker.super_admin.layout"})
|
|
70
|
+
const {lgUp, mdUp, mdDown} = useBreakpoint()
|
|
71
|
+
|
|
72
|
+
this.useStates({menuTriggered: false})
|
|
73
|
+
this.setInstance({currentUser, lgUp, mdUp, mdDown, t})
|
|
74
|
+
|
|
75
|
+
useMemo(() => {
|
|
76
|
+
CommandsPool.current().globalRequestData.layout = "admin"
|
|
77
|
+
CommandsPool.current().globalRequestData.locale = locale
|
|
78
|
+
}, [locale])
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
render() {
|
|
82
|
+
const {currentUser, lgUp, mdUp, mdDown, t} = this.tt
|
|
83
|
+
const {
|
|
84
|
+
actions,
|
|
85
|
+
active,
|
|
86
|
+
children,
|
|
87
|
+
className,
|
|
88
|
+
currentCustomer,
|
|
89
|
+
currentCustomerId,
|
|
90
|
+
headTitle,
|
|
91
|
+
headerTitle,
|
|
92
|
+
menu,
|
|
93
|
+
...restProps
|
|
94
|
+
} = this.props
|
|
95
|
+
const actualHeadTitle = headTitle || headerTitle
|
|
96
|
+
|
|
97
|
+
if (actualHeadTitle) {
|
|
98
|
+
document.title = actualHeadTitle
|
|
99
|
+
} else {
|
|
100
|
+
document.title = "Super Admin"
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const noAccess = !currentUser
|
|
104
|
+
const appLayoutContentContainerStyles = [styles.appLayoutContentContainer.base]
|
|
105
|
+
|
|
106
|
+
if (mdDown) appLayoutContentContainerStyles.push(styles.appLayoutContentContainer.mdDown)
|
|
107
|
+
if (mdUp) appLayoutContentContainerStyles.push(styles.appLayoutContentContainer.mdUp)
|
|
108
|
+
if (lgUp) appLayoutContentContainerStyles.push(styles.appLayoutContentContainer.lgUp)
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<View
|
|
112
|
+
dataSet={{component: "super-admin--layout", class: className, menuTriggered: this.s.menuTriggered}}
|
|
113
|
+
style={styles.rootView}
|
|
114
|
+
{...restProps}>
|
|
115
|
+
<Menu
|
|
116
|
+
active={active}
|
|
117
|
+
noAccess={noAccess}
|
|
118
|
+
onRequestMenuClose={this.tt.onRequestMenuClose}
|
|
119
|
+
triggered={this.s.menuTriggered}
|
|
120
|
+
/>
|
|
121
|
+
<Header actions={actions} onTriggerMenu={this.tt.onTriggerMenu} title={headerTitle} />
|
|
122
|
+
<View dataSet={{class: "app-layout-content-container"}} style={appLayoutContentContainerStyles}>
|
|
123
|
+
{noAccess &&
|
|
124
|
+
<>
|
|
125
|
+
<NoAccess />
|
|
126
|
+
{currentUser &&
|
|
127
|
+
<>
|
|
128
|
+
<Text style={styles.mb15}>
|
|
129
|
+
{t(".try_signing_out_and_in_with_a_different_user", {defaultValue: "Try signing in with a different user."})}
|
|
130
|
+
</Text>
|
|
131
|
+
</>
|
|
132
|
+
}
|
|
133
|
+
{!currentUser &&
|
|
134
|
+
<>
|
|
135
|
+
<Text style={styles.mb15}>
|
|
136
|
+
{t(".try_signing_in", {defaultValue: "Try signing in."})}
|
|
137
|
+
</Text>
|
|
138
|
+
{config.signInContent()}
|
|
139
|
+
</>
|
|
140
|
+
}
|
|
141
|
+
</>
|
|
142
|
+
}
|
|
143
|
+
{!noAccess && children}
|
|
144
|
+
</View>
|
|
145
|
+
</View>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
onRequestMenuClose = () => this.setState({menuTriggered: false})
|
|
150
|
+
onTriggerMenu = (e) => {
|
|
151
|
+
e.preventDefault()
|
|
152
|
+
this.setState({menuTriggered: !this.s.menuTriggered})
|
|
153
|
+
}
|
|
154
|
+
}))
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {StyleSheet, View} from "react-native"
|
|
2
|
+
import BaseComponent from "../../../base-component"
|
|
3
|
+
import Icon from "../../../utils/icon"
|
|
4
|
+
import memo from "set-state-compare/src/memo"
|
|
5
|
+
import Link from "../../../link"
|
|
6
|
+
import MenuContent from "./menu-content"
|
|
7
|
+
import MenuItem from "./menu-item"
|
|
8
|
+
import Params from "../../../params"
|
|
9
|
+
import PropTypes from "prop-types"
|
|
10
|
+
import PropTypesExact from "prop-types-exact"
|
|
11
|
+
import React from "react"
|
|
12
|
+
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
13
|
+
import Text from "../../../utils/text"
|
|
14
|
+
import useBreakpoint from "../../../use-breakpoint"
|
|
15
|
+
import useCurrentUser from "../../../use-current-user"
|
|
16
|
+
import useI18n from "i18n-on-steroids/src/use-i18n"
|
|
17
|
+
import {WithDefaultStyle} from "../../../utils/default-style"
|
|
18
|
+
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
root: {
|
|
21
|
+
base: {
|
|
22
|
+
position: "fixed",
|
|
23
|
+
zIndex: 9,
|
|
24
|
+
overflowY: "auto",
|
|
25
|
+
overflowX: "hidden",
|
|
26
|
+
top: 0,
|
|
27
|
+
left: 0,
|
|
28
|
+
height: "100%",
|
|
29
|
+
flexDirection: "column",
|
|
30
|
+
backgroundColor: "#1b1c1e"
|
|
31
|
+
},
|
|
32
|
+
mdDown: {
|
|
33
|
+
width: "100%",
|
|
34
|
+
maxWidth: 250,
|
|
35
|
+
maxHeight: "100vh",
|
|
36
|
+
overflowY: "auto"
|
|
37
|
+
},
|
|
38
|
+
mdUp: {
|
|
39
|
+
width: 250
|
|
40
|
+
},
|
|
41
|
+
lgUp: {
|
|
42
|
+
width: 290
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
userName: {
|
|
46
|
+
flexShrink: 1,
|
|
47
|
+
marginLeft: 8
|
|
48
|
+
},
|
|
49
|
+
userNameContainer: {
|
|
50
|
+
overflow: "hidden",
|
|
51
|
+
maxWidth: 140
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
export default memo(shapeComponent(class ComponentsAdminLayoutMenu extends BaseComponent {
|
|
56
|
+
static propTypes = PropTypesExact({
|
|
57
|
+
active: PropTypes.string,
|
|
58
|
+
noAccess: PropTypes.bool.isRequired,
|
|
59
|
+
onRequestMenuClose: PropTypes.func.isRequired,
|
|
60
|
+
triggered: PropTypes.bool.isRequired
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
setup() {
|
|
64
|
+
const {lgUp, mdDown, mdUp} = useBreakpoint()
|
|
65
|
+
const {t} = useI18n({namespace: "js.api_maker.super_admin.layout.menu"})
|
|
66
|
+
const currentUser = useCurrentUser()
|
|
67
|
+
|
|
68
|
+
this.setInstance({currentUser, lgUp, mdDown, mdUp, t})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
render() {
|
|
72
|
+
const {currentUser, lgUp, mdDown, mdUp, t} = this.tt
|
|
73
|
+
const {active, noAccess, triggered} = this.props
|
|
74
|
+
|
|
75
|
+
const style = [styles.root.base]
|
|
76
|
+
|
|
77
|
+
if (mdDown) style.push(styles.root.mdDown)
|
|
78
|
+
if (mdUp) style.push(styles.root.mdUp)
|
|
79
|
+
if (lgUp) style.push(styles.root.lgUp)
|
|
80
|
+
|
|
81
|
+
if (mdDown && !triggered) {
|
|
82
|
+
return null
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<View dataSet={{component: "super-admin--layout--menu", triggered}} style={style}>
|
|
87
|
+
<WithDefaultStyle style={{Text: {color: "#fff"}}}>
|
|
88
|
+
<View
|
|
89
|
+
dataSet={{class: "menu-logo"}}
|
|
90
|
+
style={{
|
|
91
|
+
overflow: "hidden",
|
|
92
|
+
marginTop: 25,
|
|
93
|
+
marginRight: "auto",
|
|
94
|
+
marginLeft: "auto"
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
<Link dataSet={{class: "menu-logo-link"}} to={Params.withParams({})}>
|
|
98
|
+
<Text
|
|
99
|
+
style={{
|
|
100
|
+
fontSize: 42,
|
|
101
|
+
textOverflow: "ellipsis",
|
|
102
|
+
whiteSpace: "nowrap"
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
Admin
|
|
106
|
+
</Text>
|
|
107
|
+
</Link>
|
|
108
|
+
</View>
|
|
109
|
+
<View dataSet={{class: "menu-items-center"}} style={{marginTop: 25}}>
|
|
110
|
+
{!noAccess &&
|
|
111
|
+
<MenuContent active={active} />
|
|
112
|
+
}
|
|
113
|
+
</View>
|
|
114
|
+
<View dataSet={{class: "menu-items-bottom"}} style={{marginTop: "auto", marginBottom: 25}}>
|
|
115
|
+
{currentUser &&
|
|
116
|
+
<View
|
|
117
|
+
dataSet={{class: "menu-user-section"}}
|
|
118
|
+
style={{
|
|
119
|
+
flexDirection: "row",
|
|
120
|
+
alignItems: "center",
|
|
121
|
+
marginRight: 25,
|
|
122
|
+
marginBottom: 25,
|
|
123
|
+
marginLeft: 25
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<View
|
|
127
|
+
dataSet={{class: "menu-user-icon"}}
|
|
128
|
+
style={{
|
|
129
|
+
width: 44,
|
|
130
|
+
height: 44,
|
|
131
|
+
alignItems: "center",
|
|
132
|
+
justifyContent: "center",
|
|
133
|
+
backgroundColor: "#abbcd0",
|
|
134
|
+
borderRadius: "50%"
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
<Icon name="user" size={12} />
|
|
138
|
+
</View>
|
|
139
|
+
<View className="menu-user-name" style={styles.userName}>
|
|
140
|
+
<Text dataSet={{class: "menu-user-name-container"}} style={styles.userNameContainer}>
|
|
141
|
+
{currentUser.name()}
|
|
142
|
+
</Text>
|
|
143
|
+
</View>
|
|
144
|
+
</View>
|
|
145
|
+
}
|
|
146
|
+
{currentUser &&
|
|
147
|
+
<MenuItem
|
|
148
|
+
active
|
|
149
|
+
className="sign-out-menu-item"
|
|
150
|
+
icon="sign-out-alt"
|
|
151
|
+
label={t(".sign_out", {defaultValue: "Sign out"})}
|
|
152
|
+
onClick={this.tt.onSignOutClicked}
|
|
153
|
+
/>
|
|
154
|
+
}
|
|
155
|
+
</View>
|
|
156
|
+
</WithDefaultStyle>
|
|
157
|
+
</View>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
onSignOutClicked = async (e) => {
|
|
162
|
+
e.preventDefault()
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
await Devise.signOut()
|
|
166
|
+
FlashMessage.success(this.t(".you_have_been_signed_out", {defaultValue: "You have been signed out"}))
|
|
167
|
+
} catch (error) {
|
|
168
|
+
FlashMessage.errorResponse(error)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}))
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, {useMemo} from "react"
|
|
2
|
+
import BaseComponent from "../../../base-component"
|
|
3
|
+
import {digg} from "diggerize"
|
|
4
|
+
import memo from "set-state-compare/src/memo"
|
|
5
|
+
import MenuItem from "./menu-item"
|
|
6
|
+
import models from "../../models"
|
|
7
|
+
import Params from "../../../params"
|
|
8
|
+
import PropTypes from "prop-types"
|
|
9
|
+
import PropTypesExact from "prop-types-exact"
|
|
10
|
+
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
11
|
+
import useCanCan from "../../../use-can-can"
|
|
12
|
+
import useI18n from "i18n-on-steroids/src/use-i18n"
|
|
13
|
+
|
|
14
|
+
export default memo(shapeComponent(class ComponentsAdminLayoutMenuContent extends BaseComponent {
|
|
15
|
+
static propTypes = PropTypesExact({
|
|
16
|
+
active: PropTypes.string
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
const {locale} = useI18n({namespace: "js.api_maker.super_admin.layout.menu.menu_content"})
|
|
21
|
+
const {active} = this.p
|
|
22
|
+
const canCan = useCanCan(() => models.map((modelClass) => [modelClass, ["index"]]))
|
|
23
|
+
const sortedModels = useMemo(
|
|
24
|
+
() => models.sort((a, b) => a.modelName().human({count: 2}).toLowerCase().localeCompare(b.modelName().human({count: 2}).toLowerCase())),
|
|
25
|
+
[locale]
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
{sortedModels.map((model) => canCan?.can("index", model) &&
|
|
31
|
+
<MenuItem
|
|
32
|
+
active={active}
|
|
33
|
+
icon="sitemap"
|
|
34
|
+
identifier={digg(model.modelClassData(), "name")}
|
|
35
|
+
label={model.modelName().human({count: 2})}
|
|
36
|
+
key={model.modelClassData().name}
|
|
37
|
+
to={Params.withParams({model: model.modelClassData().name})}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
</>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
}))
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import BaseComponent from "../../../base-component"
|
|
2
|
+
import classNames from "classnames"
|
|
3
|
+
import Link from "../../../link"
|
|
4
|
+
import memo from "set-state-compare/src/memo"
|
|
5
|
+
import PropTypes from "prop-types"
|
|
6
|
+
import React from "react"
|
|
7
|
+
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
8
|
+
import Text from "../../../utils/text"
|
|
9
|
+
|
|
10
|
+
export default memo(shapeComponent(class ComponentsAdminLayoutMenuMenuItem extends BaseComponent {
|
|
11
|
+
static propTypes = {
|
|
12
|
+
active: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
13
|
+
className: PropTypes.string,
|
|
14
|
+
icon: PropTypes.string.isRequired,
|
|
15
|
+
label: PropTypes.node
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setup() {
|
|
19
|
+
this.useStates({
|
|
20
|
+
hover: false
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
const {active, children, className, icon, identifier, label, to, ...restProps} = this.props
|
|
26
|
+
const {hover} = this.s
|
|
27
|
+
const textStyle = {}
|
|
28
|
+
const style = {
|
|
29
|
+
display: "flex",
|
|
30
|
+
width: "80%",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
paddingTop: 10,
|
|
33
|
+
paddingRight: 14,
|
|
34
|
+
paddingBottom: 10,
|
|
35
|
+
paddingLeft: 14,
|
|
36
|
+
marginLeft: "auto",
|
|
37
|
+
marginRight: "auto"
|
|
38
|
+
}
|
|
39
|
+
const isActive = active === true || active == identifier
|
|
40
|
+
|
|
41
|
+
if (isActive || hover) {
|
|
42
|
+
style.background = "#323435"
|
|
43
|
+
style.borderRadius = 7
|
|
44
|
+
textStyle.color = "#b9b9bb"
|
|
45
|
+
} else {
|
|
46
|
+
textStyle.color = "#6f6f71"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Link
|
|
51
|
+
dataSet={{
|
|
52
|
+
active: isActive,
|
|
53
|
+
class: classNames("components--admin--layout--menu--menu-item", className),
|
|
54
|
+
identifier
|
|
55
|
+
}}
|
|
56
|
+
onPointerEnter={this.tt.onPointerEnter}
|
|
57
|
+
onPointerLeave={this.tt.onPointerLeave}
|
|
58
|
+
style={style}
|
|
59
|
+
to={to || "#"}
|
|
60
|
+
{...restProps}
|
|
61
|
+
>
|
|
62
|
+
<i className={`fa fa-fw fa-${icon} menu-item-icon`} style={{color: textStyle.color, marginRight: 4, fontSize: 12}} />
|
|
63
|
+
{children || <Text style={textStyle}>{label}</Text>}
|
|
64
|
+
</Link>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onPointerEnter = () => this.setState({hover: true})
|
|
69
|
+
onPointerLeave = () => this.setState({hover: false})
|
|
70
|
+
}))
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import BaseComponent from "../../base-component"
|
|
2
|
+
import memo from "set-state-compare/src/memo"
|
|
3
|
+
import React from "react"
|
|
4
|
+
import {View} from "react-native"
|
|
5
|
+
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
6
|
+
import Text from "../../utils/text"
|
|
7
|
+
import useCurrentUser from "../../use-current-user"
|
|
8
|
+
import useI18n from "i18n-on-steroids/src/use-i18n"
|
|
9
|
+
|
|
10
|
+
export default memo(shapeComponent(class ComponentsAdminLayoutNoAccess extends BaseComponent {
|
|
11
|
+
render() {
|
|
12
|
+
const currentUser = useCurrentUser()
|
|
13
|
+
const {t} = useI18n({namespace: "js.api_maker.super_admin.layout.no_access"})
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<View
|
|
17
|
+
dataSet={{
|
|
18
|
+
component: "super-admin--layout--no-access",
|
|
19
|
+
userRoles: currentUser?.userRoles()?.loaded()?.map((userRole) => userRole.role()?.identifier()).join(", ")
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
<Text>{t(".you_dont_have_no_access_to_this_page", {defaultValue: "You don't have access to this page."})}</Text>
|
|
23
|
+
</View>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
}))
|