@mohamed-karawia/library 0.1.17 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. package/dist/stories/Chat/Chat.js +129 -14
  2. package/dist/stories/Common Inputs/Picker/Picker.js +61 -0
  3. package/dist/stories/Common Inputs/TextField/TextField.js +3 -1
  4. package/dist/stories/Community/Community.js +137 -0
  5. package/dist/stories/Enrollment/Admin/DetailedForm/DetailedForm.js +10 -12
  6. package/dist/stories/Enrollment/Admin/ViewForms/ViewForms.js +1 -1
  7. package/dist/stories/Enrollment/Guest/FillForm/FillForm.js +4 -17
  8. package/dist/stories/Events/Event/Event.js +116 -5
  9. package/dist/stories/Events/EventsList/EventsList.js +94 -19
  10. package/dist/stories/Forms/CreateSpace/CreateSpace.js +75 -0
  11. package/dist/stories/Library/Folders/Folders.js +77 -5
  12. package/dist/stories/Library/Notes/Notes.js +78 -4
  13. package/dist/stories/Modals/NavbarPreviewModal/NavbarPreviewModal.js +54 -0
  14. package/dist/stories/Music Album/ViewAlbum/ViewAlbum.js +137 -15
  15. package/dist/stories/Music Album/ViewAlbums/ViewAlbums.js +67 -28
  16. package/dist/stories/Navbar/Navbar.js +1 -1
  17. package/dist/stories/Pages/Enrollment/DetailedForm/DetailedForm.js +8 -0
  18. package/dist/stories/Pages/Enrollment/FillForm/FillForm.js +7 -1
  19. package/dist/stories/Pages/Enrollment/Forms/Forms.js +3 -1
  20. package/dist/stories/Pages/Events/Event/Event.js +14 -5
  21. package/dist/stories/Pages/Events/Events/Events.js +1 -0
  22. package/dist/stories/Pages/Music/MusicAlbum/Music.js +8 -6
  23. package/dist/stories/Pages/Music/MusicAlbums/MusicAlbums.js +2 -15
  24. package/dist/stories/Pages/Photos/Albums/Albums.js +4 -1
  25. package/dist/stories/Photo Album/ViewAlbum/ViewAlbum.js +80 -19
  26. package/dist/stories/Photo Album/ViewAlbums/ViewAlbums.js +83 -25
  27. package/dist/stories/Preview/Preview.js +37 -0
  28. package/dist/stories/PreviewComponents/ChatPreview/ChatPreview.js +193 -0
  29. package/dist/stories/PreviewComponents/EventPreview/EventPreview.js +158 -0
  30. package/dist/stories/PreviewComponents/EventsPreview/EventsPreview.js +192 -0
  31. package/dist/stories/PreviewComponents/FoldersPreview/FoldersPreview.js +182 -0
  32. package/dist/stories/PreviewComponents/MusicAlbumPreview/MusicAlbumPreview.js +177 -0
  33. package/dist/stories/PreviewComponents/MusicAlbumsPreview/MusicAlbumsPreview.js +181 -0
  34. package/dist/stories/PreviewComponents/MusicPlayerPreview/MusicPlayerPreview.js +153 -0
  35. package/dist/stories/PreviewComponents/NavbarPreview/NavbarPreview.js +112 -0
  36. package/dist/stories/PreviewComponents/NotesPreview/NotesPreview.js +173 -0
  37. package/dist/stories/PreviewComponents/PhotoAlbumPreview/PhotoAlbumPreview.js +189 -0
  38. package/dist/stories/PreviewComponents/PhotoAlbumsPreview/PhotoAlbumsPreview.js +189 -0
  39. package/dist/stories/PreviewComponents/SpacesListPreview/SpacesListPreview.js +197 -0
  40. package/dist/stories/PreviewComponents/VideoAlbumPreview/VideoAlbumPreview.js +189 -0
  41. package/dist/stories/PreviewComponents/VideoAlbumsPreview/VideoAlbumsPreview.js +175 -0
  42. package/dist/stories/PreviewComponents/VideoPreview/VideoPreview.js +172 -0
  43. package/dist/stories/PreviewComponents/globalStyles.js +26 -0
  44. package/dist/stories/Reusable Components/Cards/Card-style-10/CardStyle10.js +4 -3
  45. package/dist/stories/Reusable Components/Cards/Card-style-11/CardStyle11.js +8 -4
  46. package/dist/stories/Reusable Components/Cards/Card-style-6/CardStyle6.js +10 -4
  47. package/dist/stories/Reusable Components/Cards/Card-style-8/CardStyle8.js +4 -2
  48. package/dist/stories/Reusable Components/Cards/globalCardStyles.js +2 -2
  49. package/dist/stories/Reusable Components/Community/Community.js +75 -0
  50. package/dist/stories/Reusable Components/Gallery/Gallery.js +17 -18
  51. package/dist/stories/Reusable Components/ReactModal/ReactModal.js +11 -30
  52. package/dist/stories/Reusable Components/ReusableForm/ReusableForm.js +20 -3
  53. package/dist/stories/Reusable Components/ReusableList/ReusableList.js +9 -5
  54. package/dist/stories/Reusable Components/Tabs/Tabs.js +68 -0
  55. package/dist/stories/Sections/Sections.js +8 -2
  56. package/dist/stories/VideoAlbum/AlbumsGallery/AlbumsGallery.js +77 -18
  57. package/dist/stories/VideoAlbum/VideoSpace/VideoSpace.js +96 -3
  58. package/dist/stories/VideoAlbum/ViewAlbum/ViewAlbum.js +78 -5
  59. package/dist/stories/Widgets/MusicPlayerWidget/MusicPlayerWidget.js +17 -11
  60. package/dist/stories/Widgets/SpacesListWidget/SpacesListWidget.js +115 -0
  61. package/dist/stories/Widgets/UsersWidget/UsersWidget.js +30 -0
  62. package/dist/stories/helpers/util.js +60 -3
  63. package/dist/stories/store/communities.js +943 -0
  64. package/dist/stories/store/store.js +44 -0
  65. package/package.json +5 -2
  66. package/src/stories/Chat/Chat.jsx +109 -13
  67. package/src/stories/Common Inputs/Picker/Picker.jsx +47 -0
  68. package/src/stories/Common Inputs/TextField/TextField.jsx +1 -1
  69. package/src/stories/Community/Community.jsx +110 -0
  70. package/src/stories/Enrollment/Admin/DetailedForm/DetailedForm.jsx +7 -9
  71. package/src/stories/Enrollment/Admin/ViewForms/ViewForms.jsx +3 -2
  72. package/src/stories/Enrollment/Guest/FillForm/FillForm.jsx +6 -16
  73. package/src/stories/Events/Event/Event.jsx +98 -5
  74. package/src/stories/Events/EventsList/EventsList.jsx +101 -22
  75. package/src/stories/Forms/CreateSpace/CreateSpace.jsx +73 -0
  76. package/src/stories/Library/Folders/Folders.jsx +81 -5
  77. package/src/stories/Library/Notes/Notes.jsx +65 -5
  78. package/src/stories/Modals/NavbarPreviewModal/NavbarPreviewModal.jsx +31 -0
  79. package/src/stories/Music Album/ViewAlbum/ViewAlbum.jsx +133 -14
  80. package/src/stories/Music Album/ViewAlbums/ViewAlbums.jsx +61 -32
  81. package/src/stories/Navbar/Navbar.jsx +1 -1
  82. package/src/stories/Pages/Enrollment/DetailedForm/DetailedForm.jsx +10 -1
  83. package/src/stories/Pages/Enrollment/FillForm/FillForm.jsx +6 -0
  84. package/src/stories/Pages/Enrollment/Forms/Forms.jsx +3 -1
  85. package/src/stories/Pages/Events/Event/Event.jsx +12 -4
  86. package/src/stories/Pages/Events/Events/Events.jsx +75 -74
  87. package/src/stories/Pages/Library/Folders/Library.jsx +1 -1
  88. package/src/stories/Pages/Music/MusicAlbum/Music.jsx +8 -6
  89. package/src/stories/Pages/Music/MusicAlbums/MusicAlbums.jsx +0 -13
  90. package/src/stories/Pages/Photos/Albums/Albums.jsx +3 -0
  91. package/src/stories/Photo Album/ViewAlbum/ViewAlbum.jsx +63 -13
  92. package/src/stories/Photo Album/ViewAlbums/ViewAlbums.jsx +66 -33
  93. package/src/stories/Preview/Preview.jsx +35 -0
  94. package/src/stories/PreviewComponents/ChatPreview/ChatPreview.jsx +132 -0
  95. package/src/stories/PreviewComponents/EventPreview/EventPreview.jsx +116 -0
  96. package/src/stories/PreviewComponents/EventsPreview/EventsPreview.jsx +132 -0
  97. package/src/stories/PreviewComponents/FoldersPreview/FoldersPreview.jsx +127 -0
  98. package/src/stories/PreviewComponents/MusicAlbumPreview/MusicAlbumPreview.jsx +124 -0
  99. package/src/stories/PreviewComponents/MusicAlbumsPreview/MusicAlbumsPreview.jsx +126 -0
  100. package/src/stories/PreviewComponents/MusicPlayerPreview/MusicPlayerPreview.jsx +113 -0
  101. package/src/stories/PreviewComponents/NavbarPreview/NavbarPreview.jsx +93 -0
  102. package/src/stories/PreviewComponents/NotesPreview/NotesPreview.jsx +122 -0
  103. package/src/stories/PreviewComponents/PhotoAlbumPreview/PhotoAlbumPreview.jsx +129 -0
  104. package/src/stories/PreviewComponents/PhotoAlbumsPreview/PhotoAlbumsPreview.jsx +129 -0
  105. package/src/stories/PreviewComponents/SpacesListPreview/SpacesListPreview.jsx +138 -0
  106. package/src/stories/PreviewComponents/VideoAlbumPreview/VideoAlbumPreview.jsx +129 -0
  107. package/src/stories/PreviewComponents/VideoAlbumsPreview/VideoAlbumsPreview.jsx +124 -0
  108. package/src/stories/PreviewComponents/VideoPreview/VideoPreview.jsx +125 -0
  109. package/src/stories/PreviewComponents/globalStyles.js +20 -0
  110. package/src/stories/Reusable Components/Cards/Card-style-10/CardStyle10.jsx +5 -2
  111. package/src/stories/Reusable Components/Cards/Card-style-11/CardStyle11.jsx +5 -5
  112. package/src/stories/Reusable Components/Cards/Card-style-6/CardStyle6.jsx +12 -6
  113. package/src/stories/Reusable Components/Cards/Card-style-8/CardStyle8.jsx +2 -2
  114. package/src/stories/Reusable Components/Cards/globalCardStyles.js +2 -1
  115. package/src/stories/Reusable Components/Community/Community.jsx +70 -0
  116. package/src/stories/Reusable Components/Gallery/Gallery.jsx +15 -10
  117. package/src/stories/Reusable Components/ReactModal/ReactModal.jsx +3 -25
  118. package/src/stories/Reusable Components/ReusableForm/ReusableForm.jsx +19 -7
  119. package/src/stories/Reusable Components/ReusableHeader/ReusableHeader.jsx +0 -2
  120. package/src/stories/Reusable Components/ReusableList/ReusableList.jsx +9 -4
  121. package/src/stories/Reusable Components/Tabs/Tabs.jsx +67 -0
  122. package/src/stories/Sections/Sections.jsx +5 -2
  123. package/src/stories/VideoAlbum/AlbumsGallery/AlbumsGallery.jsx +57 -16
  124. package/src/stories/VideoAlbum/VideoSpace/VideoSpace.jsx +70 -1
  125. package/src/stories/VideoAlbum/ViewAlbum/ViewAlbum.jsx +65 -8
  126. package/src/stories/Widgets/MusicPlayerWidget/MusicPlayerWidget.jsx +14 -7
  127. package/src/stories/Widgets/SpacesListWidget/SpacesListWidget.jsx +78 -0
  128. package/src/stories/Widgets/UsersWidget/UsersWidget.jsx +20 -0
  129. package/src/stories/helpers/util.js +42 -2
  130. package/src/stories/store/communities.js +705 -0
  131. package/src/stories/store/store.js +33 -0
  132. package/src/stories/styling.json +92 -0
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.deleteEvent = exports.addEvent = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
11
+
12
+ var _toolkit = require("@reduxjs/toolkit");
13
+
14
+ var _communities = require("./communities");
15
+
16
+ var Community = (0, _toolkit.createSlice)({
17
+ name: 'community',
18
+ initialState: _communities.community,
19
+ reducers: {
20
+ addEvent: function addEvent(state, action) {
21
+ state.spaces[1].spaceProps.events = [].concat((0, _toConsumableArray2.default)(state.spaces[1].spaceProps.events), [action.payload]); // console.log(action)
22
+ // alert
23
+
24
+ console.log(action);
25
+ },
26
+ deleteEvent: function deleteEvent(state, action) {
27
+ var eventsAfterDelete = (0, _toConsumableArray2.default)(state.spaces[1].spaceProps.events);
28
+ eventsAfterDelete.splice(action.payload, 1);
29
+ state.spaces[1].spaceProps.events = eventsAfterDelete;
30
+ }
31
+ }
32
+ });
33
+ var _Community$actions = Community.actions,
34
+ addEvent = _Community$actions.addEvent,
35
+ deleteEvent = _Community$actions.deleteEvent;
36
+ exports.deleteEvent = deleteEvent;
37
+ exports.addEvent = addEvent;
38
+ var store = (0, _toolkit.configureStore)({
39
+ reducer: {
40
+ communities: Community.reducer
41
+ }
42
+ });
43
+ var _default = store;
44
+ exports.default = _default;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ]
11
11
  ]
12
12
  },
13
- "version": "0.1.17",
13
+ "version": "0.1.21",
14
14
  "private": false,
15
15
  "dependencies": {
16
16
  "@babel/cli": "^7.16.7",
@@ -23,6 +23,7 @@
23
23
  "@editorjs/table": "^2.0.1",
24
24
  "@giphy/js-fetch-api": "^4.1.2",
25
25
  "@giphy/react-components": "^5.3.1",
26
+ "@reduxjs/toolkit": "^1.7.2",
26
27
  "@testing-library/jest-dom": "^5.11.4",
27
28
  "@testing-library/react": "^11.1.0",
28
29
  "@testing-library/user-event": "^12.1.10",
@@ -38,6 +39,7 @@
38
39
  "rc-slider": "^9.7.5",
39
40
  "react-async-hook": "^4.0.0",
40
41
  "react-autocomplete": "^1.8.1",
42
+ "react-color": "^2.19.3",
41
43
  "react-dates": "^21.8.0",
42
44
  "react-dom": "^16.14.0",
43
45
  "react-dropzone": "^11.4.0",
@@ -48,8 +50,9 @@
48
50
  "react-icons": "^4.2.0",
49
51
  "react-jinke-music-player": "^4.24.1",
50
52
  "react-mentions": "^4.3.0",
51
- "react-modal": "^3.14.3",
53
+ "react-modal": "^3.14.4",
52
54
  "react-player": "^2.9.0",
55
+ "react-redux": "^7.2.6",
53
56
  "react-resize-observer": "^1.1.1",
54
57
  "react-scripts": "4.0.1",
55
58
  "react-select": "^4.3.1",
@@ -1,40 +1,134 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
 
5
- import { controls } from '../Reusable Components/fakeData';
6
- import ReusableHeader from '../Reusable Components/ReusableHeader/ReusableHeader';
5
+
6
+ import { BsGear } from "react-icons/bs";
7
7
  import List from '../Reusable Components/ReusableList/ReusableList';
8
8
  import RichTextInput from '../Common Inputs/RichTextInput/RichTextInput';
9
+ import ChatPreview from '../PreviewComponents/ChatPreview/ChatPreview';
10
+ import Modal from '../Reusable Components/ReactModal/ReactModal';
11
+ import Community from '../Reusable Components/Community/Community';
12
+
13
+
14
+ import Tabs from '../Reusable Components/Tabs/Tabs';
15
+ import Sections from '../Sections/Sections'
16
+
17
+
18
+ const listControls = [
19
+ { icon: (<BsGear />), action: 'config', name: 'Config' },
20
+ ]
9
21
 
10
22
  const Chat = ({
11
23
  data,
12
- title,
13
- cardBackgroundColor,
14
- textColor,
15
24
  users,
25
+ title,
26
+ backgroundColor,
16
27
  ...props }) => {
17
28
 
29
+ const [showConfigModal, setShowConfigModal] = useState(false);
30
+ const [centerContext, setCenterContext] = useState(<Chat users={users} data={data}/>)
31
+
32
+ const formChanged = (values) => {
33
+ console.log('context changed')
34
+ setCenterContext(<Chat users={users} data={data} {...values} />)
35
+ }
36
+
37
+ let tabs = [
38
+ {
39
+ title: 'New', id: 'preview'
40
+ },
41
+ {
42
+ title: 'Context', id: 'community'
43
+ }
44
+ ]
45
+
46
+ let sections = [
47
+ {
48
+ title: 'Styles',
49
+ data: [
50
+ {
51
+ title: 'Styling',
52
+ id: 'styling'
53
+ }
54
+ ]
55
+ }
56
+ ]
57
+
58
+ const onIconClicked = (action) => {
59
+ if (!props.preview) {
60
+ switch (action) {
61
+ case 'config':
62
+ setShowConfigModal(true)
63
+ break;
64
+ default:
65
+ break;
66
+ }
67
+ }
68
+ }
69
+
18
70
  return (
19
- <Container>
71
+ <Container
72
+ backgroundColor={backgroundColor}>
20
73
  <List
21
- listTitle={title}
74
+ listTitle={title || 'Chat'}
22
75
  type="flat"
23
76
  data={data}
24
77
  cardStyle="card-style-8"
78
+ iconClicked={onIconClicked}
79
+ listControls={listControls}
25
80
  {...props}
26
81
  />
27
82
  <RichTextInput
28
83
  users={users}
29
84
  />
85
+ <Modal
86
+ modalIsOpen={showConfigModal}
87
+ closeModal={() => setShowConfigModal(false)}
88
+ exitModalButton={(e) => (
89
+ <div></div>
90
+ )}
91
+ >
92
+ <Sections
93
+ sections={sections}
94
+ backgroundColor={'white'}
95
+ sectionHeaderStyles={{
96
+ titleColor: 'white',
97
+ headerBackground: 'transparent'
98
+ }}
99
+ customCardStyles={{
100
+ cardPadding: 6,
101
+ cardTitleFontSize: 15,
102
+ cardBackgroundColor: '#2c2c2c',
103
+ cardTitleColor: 'white',
104
+ onHoverBackgroundColor: '#555555',
105
+ controlsStyles: {
106
+ showOnHover: true,
107
+ }
108
+ }}>
109
+ <Tabs
110
+ title="Chat Config"
111
+ tabs={tabs}
112
+ id='styling'
113
+ >
114
+ <ChatPreview
115
+ componentProps={{ data, users, title: props.title || "Chat", preview: true }}
116
+ formChanged={formChanged}
117
+ id="preview"
118
+ />
119
+ <Community
120
+ center={centerContext}
121
+ id="community" />
122
+ </Tabs>
123
+ </Sections>
124
+ </Modal>
30
125
  </Container>
31
126
  )
32
127
  }
33
128
 
34
129
  const Container = styled.div`
35
- background-color: ${cardBackgroundColor => cardBackgroundColor};
36
130
  width: 100%;
37
- padding: 15px 0;
131
+ background-color: ${({ backgroundColor }) => backgroundColor || 'transparent'};
38
132
  `
39
133
 
40
134
  Chat.defaultProps = {
@@ -44,9 +138,11 @@ Chat.defaultProps = {
44
138
  Chat.propTypes = {
45
139
  data: PropTypes.array.isRequired,
46
140
  title: PropTypes.string,
47
- cardBackgroundColor: PropTypes.string,
48
- cardTitleColor: PropTypes.string,
49
- textColor: PropTypes.string
141
+ users: PropTypes.array,
142
+ backgroundColor: PropTypes.string,
143
+ customCardStyles: PropTypes.object,
144
+ headerStyles: PropTypes.object,
145
+ preview: PropTypes.bool
50
146
  }
51
147
 
52
148
  export default Chat
@@ -0,0 +1,47 @@
1
+ import React, {useState} from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import { useField } from 'formik';
5
+
6
+ import { ChromePicker } from 'react-color';
7
+
8
+
9
+
10
+ const Picker = (props) => {
11
+ const [field, meta, helpers] = useField(props);
12
+
13
+ {
14
+ return (
15
+ <Container>
16
+ <Label htmlFor={props.name} {...props}>{props.label}</Label>
17
+ <ChromePicker
18
+ name={props.name}
19
+ color={field.value}
20
+ onChange={(color) => helpers.setValue(color.hex)}
21
+ onChangeComplete={(color) => helpers.setValue(color.hex)}
22
+ />
23
+ </Container>
24
+ );
25
+ }
26
+ };
27
+
28
+ const Container = styled.div`
29
+ display: flex;
30
+ flex-direction: column;
31
+ font-family: sans-serif;
32
+ `
33
+
34
+ const Label = styled.label`
35
+ margin-bottom: 5px;
36
+ text-transform: capitalize;
37
+ color: ${props => props.labelColor};
38
+ font-size: ${props => props.labelFontSize}px;
39
+ `
40
+
41
+ Picker.defaultProps = {};
42
+
43
+ Picker.propTypes = {
44
+ name: PropTypes.string
45
+ }
46
+
47
+ export default Picker;
@@ -10,7 +10,7 @@ const TextField = (props) => {
10
10
  return (
11
11
  <TextFieldWrapper>
12
12
  <Label htmlFor={field.name} {...props}>{props.label}</Label>
13
- <Input {...field} {...props} />
13
+ <Input type={props.type || 'text'} {...field} {...props} />
14
14
  {(meta.error && meta.touched) && <Error>{meta.error}</Error>}
15
15
  </TextFieldWrapper>
16
16
  )
@@ -0,0 +1,110 @@
1
+ import React, { useState, useEffect, useCallback } from 'react';
2
+ import styled from 'styled-components';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
+ import { addEvent, deleteEvent } from '../store/store';
5
+
6
+ import Navbar from '../Navbar/Navbar'
7
+ import Body from '../Layout/Body/Body'
8
+ import Left from '../Layout/Left/Left'
9
+ import Center from '../Layout/Center/Center'
10
+ import Right from '../Layout/Right/Right'
11
+ import BaseMaterial from '../Containers/BaseMaterial';
12
+ import WidgetContainer from "../Reusable Components/WidgetContainer/WidgetContainer";
13
+
14
+ import Chat from '../Chat/Chat';
15
+ import Event from '../Events/Event/Event';
16
+ import EventsList from '../Events/EventsList/EventsList';
17
+ import Folders from '../Library/Folders/Folders';
18
+ import Notes from '../Library/Notes/Notes';
19
+ import MusicAlbum from '../Music Album/ViewAlbum/ViewAlbum';
20
+ import MusicAlbums from '../Music Album/ViewAlbums/ViewAlbums';
21
+ import PhotoAlbum from '../Photo Album/ViewAlbum/ViewAlbum';
22
+ import PhotoAlbums from '../Photo Album/ViewAlbums/ViewAlbums';
23
+ import VideoAlbums from '../VideoAlbum/AlbumsGallery/AlbumsGallery';
24
+ import VideoAlbum from '../VideoAlbum/ViewAlbum/ViewAlbum';
25
+ import VideoSpace from '../VideoAlbum/VideoSpace/VideoSpace';
26
+
27
+ const Community = (props) => {
28
+ const [spaceType, setSpaceType] = useState('chat');
29
+ const community = useSelector(state => state.communities)
30
+ const space = useSelector(state => {
31
+ return state.communities.spaces.find(x => x.spaceType === spaceType)
32
+ })
33
+ const spacesWidget = useSelector(state => state.communities.spacesListWidget.widgetSpacesList)
34
+ const dispatch = useDispatch();
35
+
36
+ const onAddEvent = (event) => {
37
+ dispatch(addEvent(event))
38
+ }
39
+
40
+ console.log(space)
41
+
42
+ const eventIconClicked = (action, index) => {
43
+ switch (action) {
44
+ case 'delete':
45
+ dispatch(deleteEvent(index))
46
+ break;
47
+
48
+ default:
49
+ break;
50
+ }
51
+ }
52
+
53
+ const switchSpace = (index, props) => {
54
+ setSpaceType(props.id)
55
+ }
56
+
57
+
58
+ return (
59
+ <BaseMaterial {...community.styles}>
60
+ <Navbar {...community.navbarStyles} />
61
+ <Body>
62
+ <Left>
63
+ <WidgetContainer
64
+ widgetType='spaces-list'
65
+ widgetProps={{
66
+ listTitle: spacesWidget.listTitle,
67
+ spaces: spacesWidget.spaces,
68
+ cardClicked: switchSpace,
69
+ headerStyles: spacesWidget.styles.header,
70
+ ...spacesWidget.styles.body
71
+ }}
72
+ />
73
+ </Left>
74
+ <Center>
75
+ {
76
+ {
77
+ 'chat': <Chat {...space.spaceProps} {...space.styles} />,
78
+ 'event': <Event {...space.spaceProps} {...space.styles} />,
79
+ 'events_list': <EventsList cardIconClicked={eventIconClicked} onAddEvent={onAddEvent} {...space.spaceProps} {...space.styles} />,
80
+ 'folders': <Folders {...space.spaceProps} {...space.styles} />,
81
+ 'notes': <Notes {...space.spaceProps} {...space.styles} />,
82
+ 'music_album': <MusicAlbum {...space.spaceProps} {...space.styles} />,
83
+ 'music_albums': <MusicAlbums {...space.spaceProps} {...space.styles} />,
84
+ 'photo_album': <PhotoAlbum {...space.spaceProps} {...space.styles}/>,
85
+ 'photo_albums': <PhotoAlbums {...space.spaceProps} {...space.styles}/>,
86
+ 'video_albums': <VideoAlbums {...space.spaceProps} {...space.styles}/>,
87
+ 'video_album': <VideoAlbum {...space.spaceProps} {...space.styles}/>,
88
+ 'video_space': <VideoSpace {...space.spaceProps} {...space.styles}/>
89
+
90
+ }[spaceType]
91
+ }
92
+ </Center>
93
+ <Right>{
94
+ space.widgets && space.widgets.map(widget => (
95
+ <WidgetContainer
96
+ widgetType={widget.widgetType}
97
+ widgetProps={{
98
+ ...widget.widgetProps,
99
+ ...widget.styles
100
+ }}
101
+ />
102
+ ))
103
+ }</Right>
104
+ </Body>
105
+ </BaseMaterial>
106
+ );
107
+ };
108
+
109
+
110
+ export default Community;
@@ -13,11 +13,11 @@ const DetailedForm = ({
13
13
  }) => {
14
14
 
15
15
  const onAccept = () => {
16
- alert('Form Accepted')
16
+ props.onAccept()
17
17
  }
18
18
 
19
19
  const onDecline = () => {
20
- alert('Form Declined')
20
+ props.onDecline()
21
21
  }
22
22
 
23
23
  return (
@@ -26,17 +26,14 @@ const DetailedForm = ({
26
26
  <Card
27
27
  title={userName}
28
28
  img={userImg}
29
- cardImageRadius="100"
29
+ {...props.userHeaderStyles}
30
30
  />
31
31
  </User>
32
32
  <List
33
- listTitle="Form"
33
+ listTitle={props.title || "Form"}
34
34
  data={questions}
35
35
  type='flat'
36
36
  cardStyle='card-style-3'
37
- customCardStyles={{
38
- cardPadding: 10
39
- }}
40
37
  {...props}
41
38
  />
42
39
  <Buttons>
@@ -48,7 +45,7 @@ const DetailedForm = ({
48
45
  }
49
46
 
50
47
  const Container = styled.div`
51
- background-color: white;
48
+ background-color: ${props => props.backgroundColor || 'transparent'};
52
49
  padding: 10px 0;
53
50
  width: 100%;
54
51
  `
@@ -83,7 +80,8 @@ DetailedForm.defaultProps = {};
83
80
  DetailedForm.propTypes = {
84
81
  userName: PropTypes.string,
85
82
  userImg: PropTypes.string,
86
- questions: PropTypes.array
83
+ questions: PropTypes.array,
84
+ title: PropTypes.string
87
85
  }
88
86
 
89
87
  export default DetailedForm
@@ -8,7 +8,7 @@ const ViewForms = ({
8
8
  }) => {
9
9
  return (
10
10
  <List
11
- listTitle="Submitted Forms"
11
+ listTitle={props.title || "Submitted Forms"}
12
12
  data={data}
13
13
  cardStyle="card-style-9"
14
14
  type="sectioned"
@@ -20,7 +20,8 @@ const ViewForms = ({
20
20
  ViewForms.defaultProps = {};
21
21
 
22
22
  ViewForms.propTypes = {
23
- data: PropTypes.array
23
+ data: PropTypes.array,
24
+ title: PropTypes.string
24
25
  }
25
26
 
26
27
  export default ViewForms
@@ -9,13 +9,6 @@ const FillForm = ({
9
9
  ...props
10
10
  }) => {
11
11
 
12
- // const initialValues = {
13
- // question0: '',
14
- // question1: '',
15
- // question2: '',
16
- // question3: '',
17
- // question4: '',
18
- // }
19
12
 
20
13
  const onCreate = (values) => {
21
14
  console.log(values)
@@ -28,19 +21,14 @@ const FillForm = ({
28
21
  return (
29
22
  <Container>
30
23
  <Form
31
- // initialValues={initialValues}
32
- formTitle="Join Community Form"
24
+ formTitle={props.formTitle || 'Join Community Form'}
33
25
  sections={sections}
34
26
  saveBtnText={props.saveBtnText}
35
27
  cancelBtnText={props.cancelBtnText}
36
28
  saveHandler={onCreate}
37
29
  cancelHandler={cancelHandler}
38
- headerStyles={{
39
- padding: 10,
40
- headerBackground: 'black',
41
- titleColor: '#ffff',
42
- }}
43
- bodyRowGap={10}
30
+ bodyRowGap={props.bodyRowGap || 10}
31
+ {...props}
44
32
  />
45
33
  </Container>
46
34
  )
@@ -55,7 +43,9 @@ FillForm.defaultProps = {};
55
43
  FillForm.propTypes = {
56
44
  sections: PropTypes.array,
57
45
  saveBtnText: PropTypes.string,
58
- cancelBtnText: PropTypes.string
46
+ cancelBtnText: PropTypes.string,
47
+ formTitle: PropTypes.string,
48
+ bodyRowGap: PropTypes.number
59
49
  }
60
50
 
61
51
  export default FillForm;
@@ -1,9 +1,22 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
 
5
+ import { BsGear } from "react-icons/bs";
5
6
  import ReusableHeader from '../../Reusable Components/ReusableHeader/ReusableHeader';
7
+ import Modal from '../../Reusable Components/ReactModal/ReactModal';
8
+ import EventPreview from '../../PreviewComponents/EventPreview/EventPreview';
6
9
 
10
+ import Tabs from '../../Reusable Components/Tabs/Tabs';
11
+ import Sections from '../../Sections/Sections';
12
+ import WidgetContainer from "../../Reusable Components/WidgetContainer/WidgetContainer";
13
+ import Community from '../../Reusable Components/Community/Community';
14
+ // import styles from '../../styling.json'
15
+
16
+
17
+ const listControls = [
18
+ { icon: (<BsGear />), action: 'config', name: 'Config' },
19
+ ]
7
20
  const Event = ({
8
21
  cover,
9
22
  title,
@@ -16,13 +29,55 @@ const Event = ({
16
29
  dateSize,
17
30
  discColor,
18
31
  discSize,
19
- headerStyles
32
+ headerStyles,
33
+ ...props
20
34
  }) => {
35
+ const [showConfigModal, setShowConfigModal] = useState(false);
36
+ const [centerContext, setCenterContext] = useState(<Event title={title} cover={cover} date={date} disc={disc}/>)
37
+
38
+ const formChanged = (values) => {
39
+ setCenterContext(<Event title={title} cover={cover} date={date} disc={disc} {...values} />)
40
+ }
41
+
42
+ let tabs = [
43
+ {
44
+ title: 'New', id: 'preview'
45
+ },
46
+ {
47
+ title: 'Context', id: 'community'
48
+ }
49
+ ]
50
+
51
+ let sections = [
52
+ {
53
+ title: 'Styles',
54
+ data: [
55
+ {
56
+ title: 'Styling',
57
+ id: 'styling'
58
+ }
59
+ ]
60
+ }
61
+ ]
62
+
63
+ const onIconClicked = (action) => {
64
+ if (!props.preview) {
65
+ switch (action) {
66
+ case 'config':
67
+ setShowConfigModal(true)
68
+ break;
69
+ default:
70
+ break;
71
+ }
72
+ }
73
+ }
21
74
  return (
22
75
  <Container
23
76
  backgroundColor={backgroundColor}>
24
77
  <ReusableHeader
25
78
  title={title}
79
+ controls={listControls}
80
+ iconClicked={onIconClicked}
26
81
  {...headerStyles}
27
82
  />
28
83
  <CoverWrapper>
@@ -40,6 +95,44 @@ const Event = ({
40
95
  {disc}
41
96
  </Disc>
42
97
  </Details>
98
+ <Modal
99
+ modalIsOpen={showConfigModal}
100
+ closeModal={() => setShowConfigModal(false)}
101
+ exitModalButton={(e) => (
102
+ <div></div>
103
+ )}
104
+ >
105
+ {/* <Sections
106
+ sections={sections}
107
+ backgroundColor={'white'}
108
+ sectionHeaderStyles={{
109
+ titleColor: 'white',
110
+ headerBackground: 'transparent'
111
+ }}
112
+ customCardStyles={{
113
+ cardPadding: 6,
114
+ cardTitleFontSize: 15,
115
+ cardBackgroundColor: '#2c2c2c',
116
+ cardTitleColor: 'white',
117
+ onHoverBackgroundColor: '#555555',
118
+ controlsStyles: {
119
+ showOnHover: true,
120
+ }
121
+ }} /> */}
122
+ <Tabs
123
+ title="Event Config"
124
+ tabs={tabs}
125
+ >
126
+ <EventPreview
127
+ componentProps={{ cover, title, date, disc, preview: true }}
128
+ formChanged={formChanged}
129
+ id='preview'
130
+ />
131
+ <Community
132
+ center={centerContext}
133
+ id="community" />
134
+ </Tabs>
135
+ </Modal>
43
136
  </Container>
44
137
  )
45
138
  }
@@ -47,7 +140,7 @@ const Event = ({
47
140
  const Container = styled.div`
48
141
  width: 100%;
49
142
  font-family: sans-serif;
50
- background-color: ${({ backgroundColor }) => backgroundColor};
143
+ background-color: ${({ backgroundColor }) => backgroundColor || 'transparent'};
51
144
  `
52
145
 
53
146
  const CoverWrapper = styled.div`
@@ -101,10 +194,10 @@ Event.propTypes = {
101
194
  titleSize: PropTypes.number,
102
195
  dateColor: PropTypes.string,
103
196
  dateSize: PropTypes.number,
104
- headerBackground: PropTypes.string,
105
- headerTitleColor: PropTypes.string,
106
197
  discColor: PropTypes.string,
107
198
  discSize: PropTypes.number,
199
+ headerStyles: PropTypes.object,
200
+ peview: PropTypes.bool
108
201
  }
109
202
 
110
203
  export default Event