@gnar-engine/cli 1.0.3 → 1.0.5
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/bootstrap/deploy.localdev.yml +44 -30
- package/bootstrap/secrets.localdev.yml +20 -14
- package/bootstrap/services/control/src/config.js +4 -0
- package/bootstrap/services/{agent → page}/Dockerfile +3 -3
- package/bootstrap/services/page/package.json +16 -0
- package/bootstrap/services/page/src/app.js +50 -0
- package/bootstrap/services/page/src/commands/block.handler.js +94 -0
- package/bootstrap/services/page/src/commands/page.handler.js +167 -0
- package/bootstrap/services/page/src/config.js +62 -0
- package/bootstrap/services/page/src/controllers/block.http.controller.js +87 -0
- package/bootstrap/services/page/src/controllers/message.controller.js +51 -0
- package/bootstrap/services/page/src/controllers/page.http.controller.js +89 -0
- package/bootstrap/services/page/src/policies/block.policy.js +50 -0
- package/bootstrap/services/page/src/policies/page.policy.js +49 -0
- package/bootstrap/services/page/src/schema/page.schema.js +139 -0
- package/bootstrap/services/page/src/services/block.service.js +83 -0
- package/bootstrap/services/page/src/services/page.service.js +83 -0
- package/bootstrap/services/portal/Dockerfile +7 -10
- package/bootstrap/services/portal/README.md +66 -15
- package/bootstrap/services/portal/index.html +13 -0
- package/bootstrap/services/portal/nginx.conf +5 -12
- package/bootstrap/services/portal/package.json +27 -53
- package/bootstrap/services/portal/public/vite.svg +1 -0
- package/bootstrap/services/portal/react-router.config.js +7 -0
- package/bootstrap/services/portal/src/App.jsx +16 -0
- package/bootstrap/services/portal/src/assets/gnar-engine-white-logo.svg +9 -0
- package/bootstrap/services/portal/src/assets/icon-agent.svg +6 -0
- package/bootstrap/services/portal/src/assets/icon-cog.svg +4 -0
- package/bootstrap/services/portal/src/assets/icon-delete.svg +3 -0
- package/bootstrap/services/portal/src/assets/icon-home.svg +3 -0
- package/bootstrap/services/portal/src/assets/icon-padlock.svg +3 -0
- package/bootstrap/services/portal/src/assets/icon-page.svg +6 -0
- package/bootstrap/services/portal/src/assets/icon-reports.svg +3 -0
- package/bootstrap/services/portal/src/assets/icon-user.svg +3 -0
- package/bootstrap/services/portal/src/assets/icon-users.svg +3 -0
- package/bootstrap/services/portal/src/assets/login-green-rad-back-1.jpg +0 -0
- package/bootstrap/services/portal/src/assets/react.svg +1 -0
- package/bootstrap/services/portal/src/components/CrudList/CrudList.jsx +85 -0
- package/bootstrap/services/portal/src/components/CrudList/CrudList.less +59 -0
- package/bootstrap/services/portal/src/{ui/customSelect → components/CustomSelect}/CustomSelect.jsx +21 -3
- package/bootstrap/services/portal/src/components/LoginForm/LoginForm.jsx +58 -0
- package/bootstrap/services/portal/src/components/PageBlockSwitch/PageBlockSwitch.jsx +129 -0
- package/bootstrap/services/portal/src/components/Sidebar/Sidebar.jsx +33 -0
- package/bootstrap/services/portal/src/components/Sidebar/Sidebar.less +37 -0
- package/bootstrap/services/portal/src/components/Topbar/Topbar.jsx +19 -0
- package/bootstrap/services/portal/src/components/Topbar/Topbar.less +22 -0
- package/bootstrap/services/portal/src/components/UserInfo/UserInfo.jsx +33 -0
- package/bootstrap/services/portal/src/components/UserInfo/UserInfo.less +21 -0
- package/bootstrap/services/portal/src/css/style.css +446 -742
- package/bootstrap/services/portal/src/data/pages.data.js +10 -0
- package/bootstrap/services/portal/src/elements/CustomSelect/CustomSelect.jsx +65 -0
- package/bootstrap/services/portal/src/{ui/customSelect/customSelect.less → elements/CustomSelect/CustomSelect.less} +17 -7
- package/bootstrap/services/portal/src/elements/ImageInput/ImageInput.jsx +115 -0
- package/bootstrap/services/portal/src/elements/ImageInput/ImageInput.less +43 -0
- package/bootstrap/services/portal/src/elements/ImageMultiInput/ImageMultiInput.jsx +124 -0
- package/bootstrap/services/portal/src/elements/ImageMultiInput/ImageMultiInput.less +0 -0
- package/bootstrap/services/portal/src/elements/Repeater/Repeater.jsx +52 -0
- package/bootstrap/services/portal/src/elements/Repeater/Repeater.less +70 -0
- package/bootstrap/services/portal/src/elements/RichTextInput/RichTextInput.jsx +18 -0
- package/bootstrap/services/portal/src/elements/RichTextInput/RichTextInput.less +37 -0
- package/bootstrap/services/portal/src/elements/SaveButton/SaveButton.jsx +45 -0
- package/bootstrap/services/portal/src/elements/SelectRepeater/SelectRepeater.jsx +63 -0
- package/bootstrap/services/portal/src/elements/SelectRepeater/SelectRepeater.less +23 -0
- package/bootstrap/services/portal/src/elements/TextInput/TextInput.jsx +17 -0
- package/bootstrap/services/portal/src/layouts/Card/Card.jsx +15 -0
- package/bootstrap/services/portal/src/layouts/PortalLayout/PortalLayout.jsx +29 -0
- package/bootstrap/services/portal/src/layouts/PortalLayout/PortalLayout.less +49 -0
- package/bootstrap/services/portal/src/main.jsx +51 -0
- package/bootstrap/services/portal/src/pages/BlockSinglePage/BlockSinglePage.jsx +277 -0
- package/bootstrap/services/portal/src/pages/BlocksPage/BlocksPage.jsx +23 -0
- package/bootstrap/services/portal/src/pages/DashboardPage/DashboardPage.jsx +11 -0
- package/bootstrap/services/portal/src/pages/DashboardPage/DashboardPage.less +0 -0
- package/bootstrap/services/portal/src/pages/LoginPage/LoginPage.jsx +21 -0
- package/bootstrap/services/portal/src/pages/LoginPage/LoginPage.less +51 -0
- package/bootstrap/services/portal/src/pages/PageSinglePage/PageSinglePage.jsx +338 -0
- package/bootstrap/services/portal/src/pages/PagesPage/PagesPage.jsx +23 -0
- package/bootstrap/services/portal/src/pages/UserSinglePage/UserSinglePage.jsx +9 -0
- package/bootstrap/services/portal/src/pages/UserSinglePage/UserSinglePage.less +0 -0
- package/bootstrap/services/portal/src/pages/UsersPage/UsersPage.jsx +25 -0
- package/bootstrap/services/portal/src/pages/UsersPage/UsersPage.less +0 -0
- package/bootstrap/services/portal/src/services/block.js +28 -0
- package/bootstrap/services/portal/src/services/client.js +67 -0
- package/bootstrap/services/portal/src/services/gravatar.js +14 -0
- package/bootstrap/services/portal/src/services/page.js +28 -0
- package/bootstrap/services/portal/src/services/storage.js +62 -0
- package/bootstrap/services/portal/src/services/user.js +41 -0
- package/bootstrap/services/portal/src/slices/authSlice.js +44 -14
- package/bootstrap/services/portal/src/store/configureStore.js +1 -3
- package/bootstrap/services/portal/src/style/cards.less +57 -0
- package/bootstrap/services/portal/src/{styles → style}/global.less +90 -45
- package/bootstrap/services/portal/src/style/icons.less +21 -0
- package/bootstrap/services/portal/src/style/inputs.less +52 -0
- package/bootstrap/services/portal/src/style/main.less +28 -0
- package/bootstrap/services/portal/src/utils/utils.js +9 -0
- package/bootstrap/services/portal/vite.config.js +12 -0
- package/bootstrap/services/user/Dockerfile +1 -1
- package/bootstrap/services/user/src/app.js +6 -1
- package/bootstrap/services/user/src/commands/user.handler.js +0 -3
- package/bootstrap/services/user/src/config.js +5 -1
- package/bootstrap/services/user/src/policies/user.policy.js +3 -1
- package/bootstrap/services/user/src/tests/commands/user.test.js +22 -0
- package/install-from-clone.sh +30 -0
- package/package.json +1 -1
- package/src/cli.js +8 -0
- package/src/config.js +2 -1
- package/src/dev/commands.js +10 -2
- package/src/dev/dev.service.js +167 -52
- package/src/provisioner/Dockerfile +27 -0
- package/src/provisioner/package.json +19 -0
- package/src/provisioner/src/app.js +56 -0
- package/src/provisioner/src/services/mongodb.js +58 -0
- package/src/provisioner/src/services/mysql.js +51 -0
- package/src/provisioner/src/services/secrets.js +84 -0
- package/src/scaffolder/commands.js +12 -5
- package/src/scaffolder/scaffolder.handler.js +256 -58
- package/templates/service/Dockerfile.hbs +4 -1
- package/templates/service/package.json.hbs +14 -16
- package/templates/service/src/app.js.hbs +53 -0
- package/templates/service/{commands → src/commands}/{{serviceName}}.handler.js.hbs +2 -3
- package/templates/service/src/mongodb.config.js.hbs +49 -0
- package/templates/service/{config.js.hbs → src/mysql.config.js.hbs} +10 -0
- package/{bootstrap/services/agent/src/schema/Agent.schema.js → templates/service/src/schema/{{serviceName}}.schema.js.hbs} +3 -3
- package/templates/service/src/services/mongodb.{{serviceName}}.service.js.hbs +70 -0
- package/bootstrap/services/agent/notes.md +0 -28
- package/bootstrap/services/agent/package.json +0 -16
- package/bootstrap/services/agent/src/app.js +0 -52
- package/bootstrap/services/agent/src/commands/agent.handler.js +0 -104
- package/bootstrap/services/agent/src/config.js +0 -52
- package/bootstrap/services/agent/src/controllers/http.controller.js +0 -44
- package/bootstrap/services/agent/src/controllers/message.controller.js +0 -51
- package/bootstrap/services/agent/src/db/migrations/01-init.js +0 -50
- package/bootstrap/services/agent/src/db/migrations/02-agent-service-init.js +0 -36
- package/bootstrap/services/agent/src/policies/agent.policy.js +0 -13
- package/bootstrap/services/agent/src/services/agent.service.js +0 -259
- package/bootstrap/services/agent/src/services/chatgpt.service.js +0 -46
- package/bootstrap/services/agent/src/services/manifest.service.js +0 -21
- package/bootstrap/services/portal/Dockerfile.remote +0 -40
- package/bootstrap/services/portal/public/favicon.ico +0 -0
- package/bootstrap/services/portal/public/gnar-white.png +0 -0
- package/bootstrap/services/portal/public/gnarengine-logo-black.png +0 -0
- package/bootstrap/services/portal/public/index.html +0 -43
- package/bootstrap/services/portal/public/logo192.png +0 -0
- package/bootstrap/services/portal/public/logo512.png +0 -0
- package/bootstrap/services/portal/public/manifest.json +0 -25
- package/bootstrap/services/portal/public/robots.txt +0 -3
- package/bootstrap/services/portal/src/App.js +0 -56
- package/bootstrap/services/portal/src/assets/Logo_Anchord_Black.svg +0 -1
- package/bootstrap/services/portal/src/assets/Logo_Anchord_Black_Green.svg +0 -1
- package/bootstrap/services/portal/src/assets/Logo_Anchord_White_Green.svg +0 -1
- package/bootstrap/services/portal/src/assets/activity.svg +0 -3
- package/bootstrap/services/portal/src/assets/arrow.svg +0 -3
- package/bootstrap/services/portal/src/assets/bin-white.svg +0 -3
- package/bootstrap/services/portal/src/assets/bin.svg +0 -3
- package/bootstrap/services/portal/src/assets/check.svg +0 -3
- package/bootstrap/services/portal/src/assets/chevron.svg +0 -3
- package/bootstrap/services/portal/src/assets/contact.svg +0 -3
- package/bootstrap/services/portal/src/assets/dots-vertical.svg +0 -5
- package/bootstrap/services/portal/src/assets/eye-off.svg +0 -3
- package/bootstrap/services/portal/src/assets/eye.svg +0 -4
- package/bootstrap/services/portal/src/assets/gnar-engine-black.svg +0 -47
- package/bootstrap/services/portal/src/assets/gnar-engine-white.svg +0 -47
- package/bootstrap/services/portal/src/assets/gnar_engine.svg +0 -3
- package/bootstrap/services/portal/src/assets/gnarengine-logo-black.png +0 -0
- package/bootstrap/services/portal/src/assets/home.svg +0 -3
- package/bootstrap/services/portal/src/assets/link.svg +0 -3
- package/bootstrap/services/portal/src/assets/lock.svg +0 -3
- package/bootstrap/services/portal/src/assets/package.svg +0 -4
- package/bootstrap/services/portal/src/assets/raffle.svg +0 -3
- package/bootstrap/services/portal/src/assets/settings.svg +0 -4
- package/bootstrap/services/portal/src/assets/shopping-bag.svg +0 -3
- package/bootstrap/services/portal/src/assets/user-black.svg +0 -3
- package/bootstrap/services/portal/src/assets/user.svg +0 -3
- package/bootstrap/services/portal/src/assets/users.svg +0 -3
- package/bootstrap/services/portal/src/assets/wallet.svg +0 -3
- package/bootstrap/services/portal/src/data/data.js +0 -70
- package/bootstrap/services/portal/src/features/attributeFormRow/AttributeFormRow.jsx +0 -32
- package/bootstrap/services/portal/src/features/billingShipping/BillingShipping.jsx +0 -160
- package/bootstrap/services/portal/src/features/crud/crudEdit.less +0 -230
- package/bootstrap/services/portal/src/features/crud/crudList.less +0 -134
- package/bootstrap/services/portal/src/features/crud/crudPage.less +0 -31
- package/bootstrap/services/portal/src/features/crudContact/CrudContactList.jsx +0 -108
- package/bootstrap/services/portal/src/features/crudContact/CrudContactSingle.jsx +0 -243
- package/bootstrap/services/portal/src/features/crudOrder/CrudOrderList.jsx +0 -109
- package/bootstrap/services/portal/src/features/crudOrder/CrudOrderSingle.jsx +0 -315
- package/bootstrap/services/portal/src/features/crudProducts/CrudProductList.jsx +0 -104
- package/bootstrap/services/portal/src/features/crudProducts/CrudProductSingle.jsx +0 -388
- package/bootstrap/services/portal/src/features/crudRaffles/CrudRafflesList.jsx +0 -104
- package/bootstrap/services/portal/src/features/crudRaffles/CrudRafflesSingle.jsx +0 -208
- package/bootstrap/services/portal/src/features/crudSubscription/CrudSubscriptionList.jsx +0 -110
- package/bootstrap/services/portal/src/features/crudSubscription/CrudSubscriptionSingle.jsx +0 -261
- package/bootstrap/services/portal/src/features/crudUser/CrudUserList.jsx +0 -107
- package/bootstrap/services/portal/src/features/crudUser/CrudUserSingle.jsx +0 -402
- package/bootstrap/services/portal/src/features/inventoryFormRow/InventoryFormRow.jsx +0 -30
- package/bootstrap/services/portal/src/features/lineItems/LineItems.jsx +0 -113
- package/bootstrap/services/portal/src/features/loginForm/LoginForm.jsx +0 -56
- package/bootstrap/services/portal/src/features/loginForm/loginForm.less +0 -56
- package/bootstrap/services/portal/src/features/notes/Notes.jsx +0 -18
- package/bootstrap/services/portal/src/features/passwordReset/PasswordResetForm.jsx +0 -96
- package/bootstrap/services/portal/src/features/passwordReset/PasswordResetRequestForm.jsx +0 -74
- package/bootstrap/services/portal/src/features/priceFormRow/PriceFormRow.jsx +0 -102
- package/bootstrap/services/portal/src/features/priceFormRow/priceFormRow.less +0 -24
- package/bootstrap/services/portal/src/features/raffleEntriesList/RaffleEntriesList.jsx +0 -99
- package/bootstrap/services/portal/src/features/raffleProductFormRow/RaffleProductFormRow.jsx +0 -46
- package/bootstrap/services/portal/src/features/sidebar/Sidebar.jsx +0 -64
- package/bootstrap/services/portal/src/features/sidebar/sidebar.less +0 -49
- package/bootstrap/services/portal/src/features/skus/Skus.jsx +0 -109
- package/bootstrap/services/portal/src/features/subscriptionSchedule/SubscriptionSchedule.jsx +0 -44
- package/bootstrap/services/portal/src/features/taxonomyFormRow/TaxonomyFormRow.jsx +0 -32
- package/bootstrap/services/portal/src/features/user/User.jsx +0 -54
- package/bootstrap/services/portal/src/features/user/user.less +0 -57
- package/bootstrap/services/portal/src/includes/utilities.js +0 -259
- package/bootstrap/services/portal/src/index.js +0 -14
- package/bootstrap/services/portal/src/layouts/CrudLayout.jsx +0 -50
- package/bootstrap/services/portal/src/layouts/LoginLayout.jsx +0 -17
- package/bootstrap/services/portal/src/layouts/PortalLayout.jsx +0 -48
- package/bootstrap/services/portal/src/layouts/loginLayout.less +0 -33
- package/bootstrap/services/portal/src/layouts/portalLayout.less +0 -67
- package/bootstrap/services/portal/src/pages/contacts/Contacts.jsx +0 -199
- package/bootstrap/services/portal/src/pages/dashboard/Dashboard.jsx +0 -17
- package/bootstrap/services/portal/src/pages/integrations/Integrations.jsx +0 -10
- package/bootstrap/services/portal/src/pages/login/Login.jsx +0 -15
- package/bootstrap/services/portal/src/pages/login/login.less +0 -10
- package/bootstrap/services/portal/src/pages/orders/Orders.jsx +0 -199
- package/bootstrap/services/portal/src/pages/passwordReset/PasswordResetPage.jsx +0 -15
- package/bootstrap/services/portal/src/pages/passwordResetRequest/PasswordResetRequestPage.jsx +0 -15
- package/bootstrap/services/portal/src/pages/payments/Payments.jsx +0 -10
- package/bootstrap/services/portal/src/pages/portal/Portal.jsx +0 -43
- package/bootstrap/services/portal/src/pages/products/Products.jsx +0 -212
- package/bootstrap/services/portal/src/pages/raffleEntries/RaffleEntries.jsx +0 -124
- package/bootstrap/services/portal/src/pages/raffles/Raffles.jsx +0 -186
- package/bootstrap/services/portal/src/pages/reports/Reports.jsx +0 -10
- package/bootstrap/services/portal/src/pages/settings/Settings.jsx +0 -10
- package/bootstrap/services/portal/src/pages/subscriptions/Subscriptions.jsx +0 -199
- package/bootstrap/services/portal/src/pages/users/Users.jsx +0 -193
- package/bootstrap/services/portal/src/pages/users/users.less +0 -25
- package/bootstrap/services/portal/src/styles/inputs.less +0 -157
- package/bootstrap/services/portal/src/styles/main.less +0 -26
- package/bootstrap/services/portal/src/ui/collapsible/Collapsible.jsx +0 -97
- package/bootstrap/services/portal/src/ui/collapsible/collapsible.less +0 -23
- package/bootstrap/services/portal/src/ui/customCheckbox/CustomCheckbox.jsx +0 -17
- package/bootstrap/services/portal/src/ui/customCheckbox/customCheckbox.less +0 -42
- package/bootstrap/services/portal/src/ui/customMultiSelect/CustomMultiSelect.jsx +0 -63
- package/bootstrap/services/portal/src/ui/customMultiSelect/CustomMultiSelectPeriod.jsx +0 -63
- package/bootstrap/services/portal/src/ui/goBack/GoBack.jsx +0 -19
- package/bootstrap/services/portal/src/ui/loader/Loader.jsx +0 -12
- package/bootstrap/services/portal/src/ui/pagination/Pagination.jsx +0 -23
- package/bootstrap/services/portal/src/ui/repeater/Repeater.jsx +0 -29
- package/bootstrap/services/portal/src/ui/saveButton/SaveButton.jsx +0 -69
- package/bootstrap/services/user/src/db/seeders/development/02-portal-admin-user.js +0 -27
- package/bootstrap/services/user/src/tests/user.test.js +0 -126
- package/templates/service/app.js.hbs +0 -38
- package/templates/service/schema/{{serviceName}}.schema.js.hbs +0 -14
- /package/bootstrap/services/portal/src/{ui/saveButton/saveButton.less → components/CustomSelect/CustomSelect.less} +0 -0
- /package/templates/service/{controllers → src/controllers}/http.controller.js.hbs +0 -0
- /package/templates/service/{controllers → src/controllers}/message.controller.js.hbs +0 -0
- /package/templates/service/{db → src/mysql.db}/migrations/01-init.js.hbs +0 -0
- /package/templates/service/{db → src/mysql.db}/migrations/02-{{lowerCase serviceName}}-service-init.js.hbs +0 -0
- /package/templates/service/{policies → src/policies}/{{serviceName}}.policy.js.hbs +0 -0
- /package/templates/service/{services/{{serviceName}}.service.js.hbs → src/services/mysql.{{serviceName}}.service.js.hbs} +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import TextInput from '../../elements/TextInput/TextInput';
|
|
2
|
+
import Repeater from '../../elements/Repeater/Repeater';
|
|
3
|
+
import RichTextInput from '../../elements/RichTextInput/RichTextInput';
|
|
4
|
+
import ImageInput from '../../elements/ImageInput/ImageInput';
|
|
5
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
6
|
+
|
|
7
|
+
function PageBlockSwitch({ block, pageBlocks, updatePageBlocks, blockIndex, allBlocks, parentBlockInstanceId }) {
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
{block.fields.map(field => {
|
|
12
|
+
switch (field.type) {
|
|
13
|
+
|
|
14
|
+
// text input
|
|
15
|
+
case 'text':
|
|
16
|
+
return (
|
|
17
|
+
<TextInput
|
|
18
|
+
key={field.key}
|
|
19
|
+
label={field.name}
|
|
20
|
+
placeholder={`Enter ${field.name}`}
|
|
21
|
+
value={field.value || ''}
|
|
22
|
+
onChange={(e) => {
|
|
23
|
+
const newBlock = {
|
|
24
|
+
...block,
|
|
25
|
+
fields: block.fields.map(f => ({ ...f }))
|
|
26
|
+
};
|
|
27
|
+
const newField = newBlock.fields.find(f => f.key === field.key);
|
|
28
|
+
newField.value = e.target.value;
|
|
29
|
+
updatePageBlocks(newBlock);
|
|
30
|
+
}}
|
|
31
|
+
errorMessage={`Invalid ${field.name}`}
|
|
32
|
+
isValid={true}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// rich text
|
|
37
|
+
case 'richtext':
|
|
38
|
+
return (
|
|
39
|
+
<RichTextInput
|
|
40
|
+
key={field.key}
|
|
41
|
+
label={field.name}
|
|
42
|
+
value={field.value || ''}
|
|
43
|
+
onChange={(value) => {
|
|
44
|
+
const newBlock = {
|
|
45
|
+
...block,
|
|
46
|
+
fields: block.fields.map(f => ({ ...f }))
|
|
47
|
+
};
|
|
48
|
+
const newField = newBlock.fields.find(f => f.key === field.key);
|
|
49
|
+
newField.value = value;
|
|
50
|
+
updatePageBlocks(newBlock);
|
|
51
|
+
}}
|
|
52
|
+
errorMessage={`Invalid ${field.name}`}
|
|
53
|
+
isValid={true}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// image input
|
|
58
|
+
case 'image':
|
|
59
|
+
return (
|
|
60
|
+
<ImageInput
|
|
61
|
+
key={field.key}
|
|
62
|
+
label={field.name}
|
|
63
|
+
value={field.value || ''}
|
|
64
|
+
onChange={(base64File, mimeType, fileName) => {
|
|
65
|
+
const newBlock = {
|
|
66
|
+
...block,
|
|
67
|
+
fields: block.fields.map(f => ({ ...f }))
|
|
68
|
+
};
|
|
69
|
+
const newField = newBlock.fields.find(f => f.key === field.key);
|
|
70
|
+
newField.value = newField.value || {};
|
|
71
|
+
newField.value.file = base64File;
|
|
72
|
+
newField.value.mimeType = mimeType;
|
|
73
|
+
newField.value.fileName = fileName;
|
|
74
|
+
updatePageBlocks(newBlock);
|
|
75
|
+
}}
|
|
76
|
+
errorMessage={`Invalid ${field.name}`}
|
|
77
|
+
isValid={true}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// repeater
|
|
82
|
+
case 'repeater':
|
|
83
|
+
const newRepeaterBlock = allBlocks.find(b => b.key === field.repeaterType);
|
|
84
|
+
const defaultItem = {
|
|
85
|
+
...newRepeaterBlock,
|
|
86
|
+
instanceId: uuidv4(),
|
|
87
|
+
fields: newRepeaterBlock.fields.map(f => ({ ...f }))
|
|
88
|
+
};
|
|
89
|
+
delete defaultItem.id;
|
|
90
|
+
const existingRepeaterBlocks = block.fields.find(f => f.key === field.key)?.value || [];
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<div className="nested-block">
|
|
94
|
+
<Repeater
|
|
95
|
+
items={existingRepeaterBlocks}
|
|
96
|
+
setItem={(item, index, remove = false) => {
|
|
97
|
+
const parentInstanceId = block.instanceId;
|
|
98
|
+
updatePageBlocks({
|
|
99
|
+
...item,
|
|
100
|
+
fields: item.fields.map(f => ({ ...f }))
|
|
101
|
+
}, parentInstanceId, item.key, remove);
|
|
102
|
+
}}
|
|
103
|
+
defaultItem={defaultItem}
|
|
104
|
+
buttonText={`Add ${field.name}`}
|
|
105
|
+
renderRow={(item, index, updateItem) => {
|
|
106
|
+
console.log('Rendering nested PageBlockSwitch for item:', item);
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<PageBlockSwitch
|
|
110
|
+
block={item}
|
|
111
|
+
pageBlocks={pageBlocks}
|
|
112
|
+
updatePageBlocks={updatePageBlocks}
|
|
113
|
+
blockIndex={index}
|
|
114
|
+
allBlocks={allBlocks}
|
|
115
|
+
parentBlockInstanceId={block.instanceId}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
})}
|
|
125
|
+
</>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export default PageBlockSwitch;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import UserInfo from "../UserInfo/UserInfo";
|
|
2
|
+
import { Link } from "react-router-dom";
|
|
3
|
+
|
|
4
|
+
function Sidebar() {
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div className="portal-sidebar">
|
|
8
|
+
<div className="inner">
|
|
9
|
+
<ul>
|
|
10
|
+
<li className="icon-dashboard"><Link to="/portal/dashboard">Dashboard</Link></li>
|
|
11
|
+
</ul>
|
|
12
|
+
<span className="separator"></span>
|
|
13
|
+
<ul>
|
|
14
|
+
<li className="icon-users"><Link to="/portal/users">Users</Link></li>
|
|
15
|
+
</ul>
|
|
16
|
+
<span className="separator"></span>
|
|
17
|
+
<ul>
|
|
18
|
+
<li className="icon-users"><Link to="/portal/pages">Pages</Link></li>
|
|
19
|
+
<li><Link to="/portal/blocks">Blocks</Link></li>
|
|
20
|
+
</ul>
|
|
21
|
+
<span className="separator"></span>
|
|
22
|
+
<ul>
|
|
23
|
+
<li className="icon-reports"><Link to="/portal/reports">Reports</Link></li>
|
|
24
|
+
<li><Link to="/portal/logs">Logs</Link></li>
|
|
25
|
+
</ul>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<UserInfo />
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default Sidebar;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.portal-sidebar {
|
|
2
|
+
background: @dark-1;
|
|
3
|
+
min-width: 264px;
|
|
4
|
+
min-width: 264px;
|
|
5
|
+
min-height: 100%;
|
|
6
|
+
padding: 43px 32px;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
|
|
9
|
+
.inner {
|
|
10
|
+
|
|
11
|
+
ul {
|
|
12
|
+
padding: 0px;
|
|
13
|
+
|
|
14
|
+
li {
|
|
15
|
+
list-style: none;
|
|
16
|
+
background-size: 28px 28px;
|
|
17
|
+
background-position: left center;
|
|
18
|
+
background-repeat: no-repeat;
|
|
19
|
+
|
|
20
|
+
a {
|
|
21
|
+
display: block;
|
|
22
|
+
text-decoration: none;
|
|
23
|
+
color: @mid-grey;
|
|
24
|
+
padding-top: 7px;
|
|
25
|
+
padding-bottom: 7px;
|
|
26
|
+
padding-left: 50px;
|
|
27
|
+
font-size: 18px;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:first-of-type a {
|
|
32
|
+
color: @white;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useState} from "react";
|
|
2
|
+
|
|
3
|
+
function Topbar() {
|
|
4
|
+
|
|
5
|
+
const [agentQuest, setAgentQuestion] = useState('');
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div className="portal-topbar">
|
|
9
|
+
<div className="content flex-row">
|
|
10
|
+
<label className="input icon icon-agent agent-question">
|
|
11
|
+
Engine Agent
|
|
12
|
+
<input type="text" id="agent-question" placeholder="I'll be able to help you with tasks soon!" />
|
|
13
|
+
</label>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default Topbar;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.portal-topbar {
|
|
2
|
+
background: @green-main;
|
|
3
|
+
min-height: 100vh;
|
|
4
|
+
width: 100%;
|
|
5
|
+
|
|
6
|
+
.content {
|
|
7
|
+
padding-left: 45px;
|
|
8
|
+
padding-right: 45px;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
>.flex-row {
|
|
13
|
+
height: 71px;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: flex-end;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.agent-question {
|
|
19
|
+
width: 50%;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { useSelector } from "react-redux";
|
|
3
|
+
import { getGravatarUrl } from "../../services/gravatar";
|
|
4
|
+
|
|
5
|
+
function UserInfo() {
|
|
6
|
+
|
|
7
|
+
const { authUser } = useSelector((state) => state.auth);
|
|
8
|
+
const [loading, setLoading] = useState(true);
|
|
9
|
+
const [gravatarUrl, setGravatarUrl] = useState('');
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (authUser && authUser.email) {
|
|
13
|
+
const gravatar = getGravatarUrl(authUser.email, { size: 100 });
|
|
14
|
+
setGravatarUrl(gravatar);
|
|
15
|
+
setLoading(false);
|
|
16
|
+
}
|
|
17
|
+
}, [authUser])
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className="user-info">
|
|
21
|
+
{authUser && !loading && (
|
|
22
|
+
<div className="user-info-mini flex-row">
|
|
23
|
+
{gravatarUrl && (
|
|
24
|
+
<img src={gravatarUrl} alt="User Gravatar" className="gravatar-image" />
|
|
25
|
+
)}
|
|
26
|
+
<span className="email">{authUser.email}</span>
|
|
27
|
+
</div>
|
|
28
|
+
)}
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default UserInfo;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.user-info {
|
|
2
|
+
position: absolute;
|
|
3
|
+
bottom: 30px;
|
|
4
|
+
|
|
5
|
+
.user-info-mini {
|
|
6
|
+
align-items: center;
|
|
7
|
+
|
|
8
|
+
.email {
|
|
9
|
+
margin-top: auto;
|
|
10
|
+
margin-bottom: auto;
|
|
11
|
+
height: auto;
|
|
12
|
+
font-size: 18px;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.gravatar-image {
|
|
17
|
+
width: 35px;
|
|
18
|
+
border-radius: 20px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|