@mohamed-karawia/library 0.1.22 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. package/dist/index.js +27 -27
  2. package/dist/stories/Community/Community.js +27 -29
  3. package/dist/stories/Forms/AddPhoto/AddPhoto.js +8 -7
  4. package/dist/stories/Forms/CreateEvent/CreateEvent.js +115 -0
  5. package/dist/stories/Forms/CreateFolder/CreateFolder.js +87 -0
  6. package/dist/stories/Forms/CreateSong/CreateSong.js +98 -0
  7. package/dist/stories/Modals/AddPhotoAlbum/AddPhotoAlbum.js +38 -0
  8. package/dist/stories/Modals/AddPhotoModal/AddPhotoModal.js +40 -0
  9. package/dist/stories/Modals/AddSongModal/AddSongModal.js +41 -0
  10. package/dist/stories/Modals/AddVideoAlbumModal/AddVideoAlbumModal.js +41 -0
  11. package/dist/stories/Modals/AddVideoModal/AddVideoModal.js +39 -0
  12. package/dist/stories/Modals/ChatConfigModal/ChatContifgModal.js +93 -0
  13. package/dist/stories/Modals/CreateEventModal/CreateEventModal.js +42 -0
  14. package/dist/stories/Modals/CreateFolderModal/CreateFolderModal.js +36 -0
  15. package/dist/stories/Modals/CreateMusicAlbumModal/CreateMusicAlbumModal.js +41 -0
  16. package/dist/stories/Modals/CreateNoteModal/CreateNoteModal.js +42 -0
  17. package/dist/stories/Modals/EventConfigModal/EventConfigModal.js +99 -0
  18. package/dist/stories/Modals/EventsConfigModal/EventsConfigModal.js +87 -0
  19. package/dist/stories/Modals/FoldersConfigModal/FoldersConfigModal.js +87 -0
  20. package/dist/stories/Modals/MusicAlbumConfigModal/MusicAlbumConfigModal.js +88 -0
  21. package/dist/stories/Modals/MusicAlbumsConfigModal/MusicAlbumsConfigModal.js +87 -0
  22. package/dist/stories/Modals/NotesConfigModal/NotesConfigModal.js +87 -0
  23. package/dist/stories/Modals/PhotoAlbumConfigModal/PhotoAlbumConfigModal.js +88 -0
  24. package/dist/stories/Modals/PhotoAlbumsConfigModal/PhotoAlbumsConfigModal.js +88 -0
  25. package/dist/stories/Modals/ShowImgModal/ShowImgModal.js +62 -0
  26. package/dist/stories/Modals/VideoAlbumConfigModal/VideoAlbumConfigModal.js +88 -0
  27. package/dist/stories/Modals/VideoAlbumsConfigModal/VideoAlbumsConfigModal.js +89 -0
  28. package/dist/stories/Modals/VideoConfigModal/VideoConfigModal.js +99 -0
  29. package/dist/stories/Pages/Chat/Chat.js +1 -1
  30. package/dist/stories/Pages/Events/Event/Event.js +1 -1
  31. package/dist/stories/Pages/Events/Events/Events.js +1 -1
  32. package/dist/stories/Pages/Library/Folders/Library.js +2 -2
  33. package/dist/stories/Pages/Library/Notes/Notes.js +2 -2
  34. package/dist/stories/Pages/Music/MusicAlbum/Music.js +2 -2
  35. package/dist/stories/Pages/Music/MusicAlbums/MusicAlbums.js +2 -2
  36. package/dist/stories/Pages/Photos/Album/Album.js +2 -2
  37. package/dist/stories/Pages/Photos/Albums/Albums.js +2 -2
  38. package/dist/stories/Pages/Video/DetailedVideo/DetailedVideo.js +2 -2
  39. package/dist/stories/Pages/Video/VideoAlbum/Video.js +2 -2
  40. package/dist/stories/PreviewComponents/ChatPreview/ChatPreview.js +6 -4
  41. package/dist/stories/PreviewComponents/EventPreview/EventPreview.js +6 -4
  42. package/dist/stories/PreviewComponents/EventsPreview/EventsPreview.js +6 -4
  43. package/dist/stories/PreviewComponents/FoldersPreview/FoldersPreview.js +6 -4
  44. package/dist/stories/PreviewComponents/MusicAlbumPreview/MusicAlbumPreview.js +6 -4
  45. package/dist/stories/PreviewComponents/MusicAlbumsPreview/MusicAlbumsPreview.js +7 -6
  46. package/dist/stories/PreviewComponents/MusicPlayerPreview/MusicPlayerPreview.js +6 -4
  47. package/dist/stories/PreviewComponents/NavbarPreview/NavbarPreview.js +6 -4
  48. package/dist/stories/PreviewComponents/NotesPreview/NotesPreview.js +6 -4
  49. package/dist/stories/PreviewComponents/PhotoAlbumPreview/PhotoAlbumPreview.js +6 -4
  50. package/dist/stories/PreviewComponents/PhotoAlbumsPreview/PhotoAlbumsPreview.js +6 -4
  51. package/dist/stories/PreviewComponents/SpacesListPreview/SpacesListPreview.js +6 -4
  52. package/dist/stories/PreviewComponents/VideoAlbumPreview/VideoAlbumPreview.js +6 -4
  53. package/dist/stories/PreviewComponents/VideoAlbumsPreview/VideoAlbumsPreview.js +6 -4
  54. package/dist/stories/PreviewComponents/VideoPreview/VideoPreview.js +6 -4
  55. package/dist/stories/Reusable Components/Comments/Comments.js +58 -0
  56. package/dist/stories/Reusable Components/Sections/Sections.js +67 -0
  57. package/dist/stories/Spaces/Chat/Chat.js +103 -0
  58. package/dist/stories/Spaces/EventsList/EventsList.js +140 -0
  59. package/dist/stories/Spaces/NotesList/NotesList.js +144 -0
  60. package/dist/stories/Spaces/ViewDetailedPhoto/ViewDetailedPhoto.js +24 -0
  61. package/dist/stories/Spaces/ViewEvent/Event.js +146 -0
  62. package/dist/stories/Spaces/ViewFolders/ViewFolders.js +136 -0
  63. package/dist/stories/Spaces/ViewMusicAlbumList/ViewMusicAlbumList.js +136 -0
  64. package/dist/stories/Spaces/ViewMusicAlbums/ViewMusicAlbums.js +130 -0
  65. package/dist/stories/Spaces/ViewNote/ViewNote.js +27 -0
  66. package/dist/stories/Spaces/ViewPhotoAlbumList/ViewPhotoAlbumList.js +231 -0
  67. package/dist/stories/Spaces/ViewPhotoAlbums/ViewPhotoAlbums.js +131 -0
  68. package/dist/stories/Spaces/ViewVideo/ViewVideo.js +169 -0
  69. package/dist/stories/Spaces/ViewVideoAlbumList/ViewVideoAlbumList.js +157 -0
  70. package/dist/stories/Spaces/ViewVideoAlbums/ViewVideoAlbums.js +164 -0
  71. package/dist/stories/Widgets/VideoPlayer/VideoPlayer.js +235 -0
  72. package/dist/stories/helpers/util.js +24 -24
  73. package/dist/stories/store/actions/actions.js +16 -0
  74. package/dist/stories/store/community.js +941 -0
  75. package/dist/stories/store/store.js +9 -4
  76. package/package.json +1 -1
  77. package/src/index.js +16 -16
  78. package/src/stories/Community/Community.jsx +19 -19
  79. package/src/stories/Forms/AddPhoto/AddPhoto.jsx +72 -72
  80. package/src/stories/{Events → Forms}/CreateEvent/CreateEvent.jsx +5 -1
  81. package/src/stories/{Library → Forms}/CreateFolder/CreateFolder.jsx +0 -0
  82. package/src/stories/Forms/{AddSong/AddSong.jsx → CreateSong/CreateSong.jsx} +0 -0
  83. package/src/stories/Modals/AddPhotoAlbum/AddPhotoAlbum.jsx +27 -0
  84. package/src/stories/Modals/AddPhotoModal/AddPhotoModal.jsx +29 -0
  85. package/src/stories/Modals/AddSongModal/AddSongModal.jsx +37 -0
  86. package/src/stories/Modals/AddVideoAlbumModal/AddVideoAlbumModal.jsx +38 -0
  87. package/src/stories/Modals/AddVideoModal/AddVideoModal.jsx +35 -0
  88. package/src/stories/Modals/ChatConfigModal/ChatContifgModal.jsx +77 -0
  89. package/src/stories/Modals/CreateEventModal/CreateEventModal.jsx +30 -0
  90. package/src/stories/Modals/CreateFolderModal/CreateFolderModal.jsx +39 -0
  91. package/src/stories/Modals/CreateMusicAlbumModal/CreateMusicAlbumModal.jsx +37 -0
  92. package/src/stories/Modals/CreateNoteModal/CreateNoteModal.jsx +43 -0
  93. package/src/stories/Modals/EventConfigModal/EventConfigModal.jsx +74 -0
  94. package/src/stories/Modals/EventsConfigModal/EventsConfigModal.jsx +67 -0
  95. package/src/stories/Modals/FoldersConfigModal/FoldersConfigModal.jsx +66 -0
  96. package/src/stories/Modals/MusicAlbumConfigModal/MusicAlbumConfigModal.jsx +69 -0
  97. package/src/stories/Modals/MusicAlbumsConfigModal/MusicAlbumsConfigModal.jsx +73 -0
  98. package/src/stories/Modals/NotesConfigModal/NotesConfigModal.jsx +65 -0
  99. package/src/stories/Modals/PhotoAlbumConfigModal/PhotoAlbumConfigModal.jsx +71 -0
  100. package/src/stories/Modals/PhotoAlbumsConfigModal/PhotoAlbumsConfigModal.jsx +69 -0
  101. package/src/stories/Modals/ShowImgModal/ShowImgModal.jsx +87 -0
  102. package/src/stories/Modals/VideoAlbumConfigModal/VideoAlbumConfigModal.jsx +67 -0
  103. package/src/stories/Modals/VideoAlbumsConfigModal/VideoAlbumsConfigModal.jsx +67 -0
  104. package/src/stories/Modals/VideoConfigModal/VideoConfigModal.jsx +78 -0
  105. package/src/stories/Pages/Chat/Chat.jsx +1 -1
  106. package/src/stories/Pages/Events/Event/Event.jsx +1 -1
  107. package/src/stories/Pages/Events/Events/Events.jsx +1 -1
  108. package/src/stories/Pages/Library/Folders/Library.jsx +1 -1
  109. package/src/stories/Pages/Library/Notes/Notes.jsx +1 -1
  110. package/src/stories/Pages/Music/MusicAlbum/Music.jsx +1 -1
  111. package/src/stories/Pages/Music/MusicAlbums/MusicAlbums.jsx +1 -1
  112. package/src/stories/Pages/Photos/Album/Album.jsx +1 -1
  113. package/src/stories/Pages/Photos/Albums/Albums.jsx +1 -1
  114. package/src/stories/Pages/Video/DetailedVideo/DetailedVideo.jsx +1 -1
  115. package/src/stories/Pages/Video/VideoAlbum/Video.jsx +1 -1
  116. package/src/stories/PreviewComponents/ChatPreview/ChatPreview.jsx +106 -104
  117. package/src/stories/PreviewComponents/EventPreview/EventPreview.jsx +6 -4
  118. package/src/stories/PreviewComponents/EventsPreview/EventsPreview.jsx +106 -104
  119. package/src/stories/PreviewComponents/FoldersPreview/FoldersPreview.jsx +7 -5
  120. package/src/stories/PreviewComponents/MusicAlbumPreview/MusicAlbumPreview.jsx +6 -4
  121. package/src/stories/PreviewComponents/MusicAlbumsPreview/MusicAlbumsPreview.jsx +13 -11
  122. package/src/stories/PreviewComponents/MusicPlayerPreview/MusicPlayerPreview.jsx +35 -33
  123. package/src/stories/PreviewComponents/NavbarPreview/NavbarPreview.jsx +17 -15
  124. package/src/stories/PreviewComponents/NotesPreview/NotesPreview.jsx +6 -4
  125. package/src/stories/PreviewComponents/PhotoAlbumPreview/PhotoAlbumPreview.jsx +105 -103
  126. package/src/stories/PreviewComponents/PhotoAlbumsPreview/PhotoAlbumsPreview.jsx +7 -5
  127. package/src/stories/PreviewComponents/SpacesListPreview/SpacesListPreview.jsx +9 -7
  128. package/src/stories/PreviewComponents/VideoAlbumPreview/VideoAlbumPreview.jsx +6 -4
  129. package/src/stories/PreviewComponents/VideoAlbumsPreview/VideoAlbumsPreview.jsx +6 -4
  130. package/src/stories/PreviewComponents/VideoPreview/VideoPreview.jsx +6 -4
  131. package/src/stories/{VideoAlbum → Reusable Components}/Comments/Comments.jsx +0 -0
  132. package/src/stories/{Sections/Sections.jsx → Reusable Components/Sections/Sections.jsx } +1 -1
  133. package/src/stories/Spaces/Chat/Chat.jsx +77 -0
  134. package/src/stories/Spaces/EventsList/EventsList.jsx +118 -0
  135. package/src/stories/{Library/Notes/Notes.jsx → Spaces/NotesList/NotesList.jsx} +20 -66
  136. package/src/stories/{Photo Album/DetailedPhoto/DetailedPhoto.jsx → Spaces/ViewDetailedPhoto/ViewDetailedPhoto.jsx} +1 -1
  137. package/src/stories/{Events/Event → Spaces/ViewEvent}/Event.jsx +10 -74
  138. package/src/stories/Spaces/ViewFolders/ViewFolders.jsx +122 -0
  139. package/src/stories/Spaces/ViewMusicAlbumList/ViewMusicAlbumList.jsx +118 -0
  140. package/src/stories/Spaces/ViewMusicAlbums/ViewMusicAlbums.jsx +108 -0
  141. package/src/stories/{Library → Spaces}/ViewNote/ViewNote.jsx +0 -0
  142. package/src/stories/{Photo Album/ViewAlbum/ViewAlbum.jsx → Spaces/ViewPhotoAlbumList/ViewPhotoAlbumList.jsx} +42 -137
  143. package/src/stories/{Photo Album/ViewAlbums/ViewAlbums.jsx → Spaces/ViewPhotoAlbums/ViewPhotoAlbums.jsx} +16 -55
  144. package/src/stories/{VideoAlbum/VideoSpace/VideoSpace.jsx → Spaces/ViewVideo/ViewVideo.jsx} +15 -48
  145. package/src/stories/{VideoAlbum/ViewAlbum/ViewAlbum.jsx → Spaces/ViewVideoAlbumList/ViewVideoAlbumList.jsx} +14 -57
  146. package/src/stories/{VideoAlbum/AlbumsGallery/AlbumsGallery.jsx → Spaces/ViewVideoAlbums/ViewVideoAlbums.jsx} +14 -52
  147. package/src/stories/{VideoAlbum → Widgets}/VideoPlayer/VideoPlayer.jsx +0 -0
  148. package/src/stories/helpers/util.js +13 -13
  149. package/src/stories/store/actions/actions.js +7 -0
  150. package/src/stories/store/{communities.js → community.js} +0 -0
  151. package/src/stories/store/store.js +3 -4
  152. package/src/stories/Chat/Chat.jsx +0 -154
  153. package/src/stories/Events/EventsList/EventsList.jsx +0 -187
  154. package/src/stories/Library/Folders/Folders.jsx +0 -196
  155. package/src/stories/Music Album/ViewAlbum/ViewAlbum.jsx +0 -172
  156. package/src/stories/Music Album/ViewAlbums/ViewAlbums.jsx +0 -166
@@ -4,15 +4,7 @@ import styled from 'styled-components';
4
4
 
5
5
  import { BsGear } from "react-icons/bs";
6
6
  import ReusableHeader from '../../Reusable Components/ReusableHeader/ReusableHeader';
7
- import Modal from '../../Reusable Components/ReactModal/ReactModal';
8
- import EventPreview from '../../PreviewComponents/EventPreview/EventPreview';
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
-
7
+ import EventConfigModal from '../../Modals/EventConfigModal/EventConfigModal';
16
8
 
17
9
  const listControls = [
18
10
  { icon: (<BsGear />), action: 'config', name: 'Config' },
@@ -34,32 +26,6 @@ const Event = ({
34
26
  ...props
35
27
  }) => {
36
28
  const [showConfigModal, setShowConfigModal] = useState(false);
37
- const [centerContext, setCenterContext] = useState(<Event preview={true} title={title} cover={cover} date={date} disc={disc}/>)
38
-
39
- const formChanged = (values) => {
40
- setCenterContext(<Event preview={true} title={title} cover={cover} date={date} disc={disc} {...values} />)
41
- }
42
-
43
- let tabs = [
44
- {
45
- title: 'New', id: 'preview'
46
- },
47
- {
48
- title: 'Context', id: 'community'
49
- }
50
- ]
51
-
52
- let sections = [
53
- {
54
- title: 'Styles',
55
- data: [
56
- {
57
- title: 'Styling',
58
- id: 'styling'
59
- }
60
- ]
61
- }
62
- ]
63
29
 
64
30
  const onIconClicked = (action) => {
65
31
  if (!props.preview) {
@@ -102,45 +68,15 @@ const Event = ({
102
68
  {disc}
103
69
  </Disc>
104
70
  </Details>
105
- <Modal
106
- modalIsOpen={showConfigModal}
107
- closeModal={cancelConfig}
108
- exitModalButton={(e) => (
109
- <div></div>
110
- )}
111
- >
112
- {/* <Sections
113
- sections={sections}
114
- backgroundColor={'white'}
115
- sectionHeaderStyles={{
116
- titleColor: 'white',
117
- headerBackground: 'transparent'
118
- }}
119
- customCardStyles={{
120
- cardPadding: 6,
121
- cardTitleFontSize: 15,
122
- cardBackgroundColor: '#2c2c2c',
123
- cardTitleColor: 'white',
124
- onHoverBackgroundColor: '#555555',
125
- controlsStyles: {
126
- showOnHover: true,
127
- }
128
- }} /> */}
129
- <Tabs
130
- title="Event Config"
131
- tabs={tabs}
132
- >
133
- <EventPreview
134
- componentProps={{ cover, title, date, disc, preview: true }}
135
- formChanged={formChanged}
136
- id='preview'
137
- />
138
- <Community
139
- center={centerContext}
140
- community={community} preview={true}
141
- id="community" />
142
- </Tabs>
143
- </Modal>
71
+ <EventConfigModal
72
+ showConfigModal={showConfigModal}
73
+ cancelConfig={cancelConfig}
74
+ cover={cover}
75
+ title={title}
76
+ date={date}
77
+ disc={disc}
78
+ community={community}
79
+ />
144
80
  </Container>
145
81
  )
146
82
  }
@@ -0,0 +1,122 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import { AiOutlineFileAdd, AiFillDelete } from "react-icons/ai";
5
+ import { BsGear } from "react-icons/bs";
6
+
7
+ import Gallery from '../../Reusable Components/Gallery/Gallery';
8
+ import CreateFolderModal from '../../Modals/CreateFolderModal/CreateFolderModal';
9
+ import FoldersConfigModal from '../../Modals/FoldersConfigModal/FoldersConfigModal';
10
+
11
+
12
+ const galleryControls = [
13
+ { icon: (<AiOutlineFileAdd />), action: 'add', name: 'Add Photo' },
14
+ { icon: (<BsGear />), action: 'config', name: 'Config' },
15
+ ]
16
+
17
+ const cardControls = [
18
+ { icon: (<AiFillDelete />), action: 'delete', name: 'Delete Image' },
19
+ ]
20
+
21
+ const Folders = ({
22
+ folders,
23
+ folderTitle,
24
+ columnsNumber,
25
+ columnGap,
26
+ rowGap,
27
+ cardClicked,
28
+ iconColor,
29
+ community,
30
+ ...props
31
+ }) => {
32
+ const [showModal, setShowModal] = useState(false);
33
+ const [showConfigModal, setShowConfigModal] = useState(false);
34
+
35
+ const cancelConfig = () => {
36
+ setShowConfigModal(false);
37
+ localStorage.removeItem('formStyles')
38
+ }
39
+
40
+ const onIconClicked = (action) => {
41
+ if (!props.preview) {
42
+ switch (action) {
43
+ case 'add':
44
+ setShowModal(true)
45
+ break;
46
+ case 'config':
47
+ setShowConfigModal(true)
48
+ break;
49
+ default:
50
+ break;
51
+ }
52
+ }
53
+ }
54
+
55
+ const cardIconClicked = (action, index) => {
56
+ props.cardIconClicked(action, index)
57
+ }
58
+
59
+ const closeModal = () => {
60
+ setShowModal(false);
61
+ }
62
+
63
+ const onAddFolder = (folder) => {
64
+ props.onAddFolder(folder)
65
+ setShowModal(false)
66
+ }
67
+
68
+ return (
69
+ <Container>
70
+ <Gallery
71
+ galleryTitle={props.title || "Your Folders"}
72
+ data={folders}
73
+ type="flat"
74
+ cardStyle="card-style-10"
75
+ galleryControls={galleryControls}
76
+ iconClicked={onIconClicked}
77
+ cardClicked={cardClicked}
78
+ cardIconClicked={cardIconClicked}
79
+ cardControls={cardControls}
80
+ rowsHeight={140}
81
+ {...props} />
82
+ <CreateFolderModal
83
+ showModal={showModal}
84
+ closeModal={closeModal}
85
+ onAddFolder={onAddFolder}
86
+ />
87
+ <FoldersConfigModal
88
+ showConfigModal={showConfigModal}
89
+ cancelConfig={cancelConfig}
90
+ folders={folders}
91
+ community={community}
92
+ />
93
+ </Container>
94
+ )
95
+ }
96
+
97
+ const Container = styled.div`
98
+ background-color: transparent;
99
+ `
100
+
101
+ Folders.defaultProps = {};
102
+
103
+ Folders.propTypes = {
104
+ folders: PropTypes.array,
105
+ title: PropTypes.string,
106
+ folderTitle: PropTypes.string,
107
+ columnsNumber: PropTypes.number,
108
+ columnGap: PropTypes.number,
109
+ rowGap: PropTypes.number,
110
+ galleryControls: PropTypes.array,
111
+ onIconClicked: PropTypes.func,
112
+ cardClicked: PropTypes.func,
113
+ cardIconClicked: PropTypes.func,
114
+ cardControls: PropTypes.array,
115
+ iconColor: PropTypes.string,
116
+ titleColor: PropTypes.string,
117
+ cardTitleColor: PropTypes.string,
118
+ cardDescriptionColor: PropTypes.string,
119
+ headerStyles: PropTypes.object
120
+ }
121
+
122
+ export default Folders;
@@ -0,0 +1,118 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+
5
+ import List from '../../Reusable Components/ReusableList/ReusableList';
6
+ import AddSongModal from '../../Modals/AddSongModal/AddSongModal';
7
+ import MusicAlbumConfigModal from '../../Modals/MusicAlbumConfigModal/MusicAlbumConfigModal';
8
+ import { AiOutlineFileAdd, AiOutlineDelete } from "react-icons/ai";
9
+ import { BsGear } from "react-icons/bs";
10
+
11
+ const listControls = [
12
+ { icon: (<AiOutlineFileAdd />), action: 'add', name: 'Add Album' },
13
+ { icon: (<BsGear />), action: 'config', name: 'Config' },
14
+ ]
15
+
16
+ const cardControls = [
17
+ { icon: (<AiOutlineDelete />), action: 'delete', name: 'Delete album' },
18
+ ]
19
+
20
+ const ViewAlbum = ({
21
+ album,
22
+ cardBackgroundColor,
23
+ songTitleColor,
24
+ community,
25
+ ...props }) => {
26
+ const [showModal, setShowModal] = useState(false);
27
+ const [showConfigModal, setShowConfigModal] = useState(false);
28
+
29
+
30
+ const onIconClicked = (action) => {
31
+ if (!props.preview) {
32
+ switch (action) {
33
+ case 'add':
34
+ setShowModal(true)
35
+ break;
36
+ case 'config':
37
+ setShowConfigModal(true)
38
+ break;
39
+ default:
40
+ break;
41
+ }
42
+ }
43
+ }
44
+
45
+ const cardIconClicked = (action, index) => {
46
+ if (!props.preview) {
47
+ props.cardIconClicked(action, index)
48
+ }
49
+ }
50
+
51
+ const onAddSong = (song) => {
52
+ setShowModal(false)
53
+ props.onAddSong(song)
54
+ }
55
+
56
+ const closeModal = () => {
57
+ setShowModal(false)
58
+ }
59
+
60
+ const closeConfigModal = () => {
61
+ localStorage.removeItem('formStyles')
62
+ setShowConfigModal(false)
63
+ }
64
+
65
+ return (
66
+ <Container>
67
+ <List
68
+ listTitle={props.title || "My Album"}
69
+ data={album}
70
+ cardStyle="card-style-7"
71
+ type="flat"
72
+ cardClicked={(index) => props.cardClicked(index)}
73
+ iconClicked={onIconClicked}
74
+ listControls={listControls}
75
+ cardControls={cardControls}
76
+ cardIconClicked={cardIconClicked}
77
+ {...props}
78
+ />
79
+ <AddSongModal
80
+ showModal={showModal}
81
+ closeModal={closeModal}
82
+ onAddSong={onAddSong}
83
+ cancelHandler={closeModal}
84
+ />
85
+ <MusicAlbumConfigModal
86
+ showConfigModal={showConfigModal}
87
+ closeModal={closeConfigModal}
88
+ album={album}
89
+ community={community}
90
+ />
91
+ </Container>
92
+ )
93
+ }
94
+
95
+ const Container = styled.div`
96
+ width: 100%;
97
+ `
98
+
99
+ ViewAlbum.defaultProps = {
100
+
101
+ };
102
+
103
+ ViewAlbum.propTypes = {
104
+ album: PropTypes.array,
105
+ onDeleteSong: PropTypes.func,
106
+ onAddSong: PropTypes.func,
107
+ cardClicked: PropTypes.func,
108
+ cardBackgroundColor: PropTypes.string,
109
+ songTitleColor: PropTypes.string,
110
+ title: PropTypes.string,
111
+ saveBtnText: PropTypes.string,
112
+ cancelBtnText: PropTypes.string,
113
+ headerStyles: PropTypes.object,
114
+ customCardStyles: PropTypes.object,
115
+ preview: PropTypes.bool
116
+ };
117
+
118
+ export default ViewAlbum
@@ -0,0 +1,108 @@
1
+ import React, { useState } from "react";
2
+ import PropTypes from "prop-types";
3
+ import styled from "styled-components";
4
+
5
+ import Gallery from "../../Reusable Components/Gallery/Gallery";
6
+ import CreateMusicAlbumModal from '../../Modals/CreateMusicAlbumModal/CreateMusicAlbumModal';
7
+ import MusicAlbumsConfigModal from "../../Modals/MusicAlbumsConfigModal/MusicAlbumsConfigModal";
8
+
9
+
10
+ import { AiOutlineFileAdd, AiFillDelete } from "react-icons/ai";
11
+ import { BsGear } from "react-icons/bs";
12
+
13
+ const cardControls = [
14
+ { icon: <AiFillDelete />, action: "delete", name: "Delete album" },
15
+ ];
16
+
17
+ const galleryControls = [
18
+ { icon: <AiOutlineFileAdd />, action: "add", name: "Add Album" },
19
+ { icon: <BsGear />, action: "config", name: "Config" },
20
+ ];
21
+
22
+ const ViewAlbums = ({ albums, community, ...props }) => {
23
+ const [showModal, setShowModal] = useState(false);
24
+ const [showConfigModal, setShowConfigModal] = useState(false);
25
+
26
+ const onHeaderIconClicked = (action) => {
27
+ if (!props.preview) {
28
+ switch (action) {
29
+ case "add":
30
+ setShowModal(true);
31
+ break;
32
+ case "config":
33
+ setShowConfigModal(true);
34
+ break;
35
+ default:
36
+ break;
37
+ }
38
+ }
39
+ };
40
+
41
+ const cardIconClicked = (action, index) => {
42
+ props.cardIconClicked(action, index);
43
+ };
44
+
45
+
46
+ const onAddAlbum = (album) => {
47
+ setShowModal(false);
48
+ props.onAddAlbum(album);
49
+ };
50
+
51
+ const closeModal = () => {
52
+ setShowModal(false);
53
+ };
54
+
55
+ const cancelConfig = () => {
56
+ setShowConfigModal(false);
57
+ localStorage.removeItem("formStyles");
58
+ };
59
+
60
+ return (
61
+ <Container>
62
+ <Gallery
63
+ galleryTitle={props.title || "Music Albums"}
64
+ data={albums}
65
+ type="flat"
66
+ cardStyle="card-style-6"
67
+ galleryControls={galleryControls}
68
+ iconClicked={onHeaderIconClicked}
69
+ cardControls={cardControls}
70
+ cardIconClicked={cardIconClicked}
71
+ {...props}
72
+ />
73
+ <CreateMusicAlbumModal
74
+ showModal={showModal}
75
+ onAddAlbum={onAddAlbum}
76
+ closeModal={closeModal}
77
+ saveBtnText={props.saveBtnText}
78
+ cancelBtnText={props.cancelBtnText}
79
+ />
80
+ <MusicAlbumsConfigModal
81
+ showConfigModal={showConfigModal}
82
+ cancelConfig={cancelConfig}
83
+ albums={albums}
84
+ community={community}
85
+ />
86
+ </Container>
87
+ );
88
+ };
89
+ const Container = styled.div`
90
+ width: 100%;
91
+ `;
92
+
93
+ ViewAlbums.defaultProps = {};
94
+
95
+ ViewAlbums.propTypes = {
96
+ albums: PropTypes.array,
97
+ cardIconClicked: PropTypes.func,
98
+ onAddAlbum: PropTypes.func,
99
+ cardBackgroundColor: PropTypes.string,
100
+ albumTitleColor: PropTypes.string,
101
+ descColor: PropTypes.string,
102
+ title: PropTypes.string,
103
+ saveBtnText: PropTypes.string,
104
+ cancelBtnText: PropTypes.string,
105
+ preview: PropTypes.bool,
106
+ };
107
+
108
+ export default ViewAlbums;
@@ -4,15 +4,10 @@ import PropTypes from 'prop-types';
4
4
 
5
5
  import AddPhoto from '../../Forms/AddPhoto/AddPhoto'
6
6
  import Gallery from '../../Reusable Components/Gallery/Gallery';
7
- import Modal from '../../Reusable Components/ReactModal/ReactModal';
8
- import DetailedPhoto from '../DetailedPhoto/DetailedPhoto';
9
- import PhotoAlbumPreview from '../../PreviewComponents/PhotoAlbumPreview/PhotoAlbumPreview';
10
- import Tabs from '../../Reusable Components/Tabs/Tabs';
11
- import Sections from '../../Sections/Sections';
12
- import Community from '../../Reusable Components/Community/Community';
13
-
14
-
15
- import { AiOutlineArrowLeft, AiOutlineArrowRight, AiOutlineClose, AiOutlineFileAdd, AiFillDelete } from "react-icons/ai";
7
+ import AddPhotoModal from '../../Modals/AddPhotoModal/AddPhotoModal';
8
+ import ShowImgModal from '../../Modals/ShowImgModal/ShowImgModal';
9
+ import PhotoAlbumConfigModal from '../../Modals/PhotoAlbumConfigModal/PhotoAlbumConfigModal';
10
+ import { AiOutlineFileAdd, AiFillDelete } from "react-icons/ai";
16
11
  import { BsGear } from "react-icons/bs";
17
12
 
18
13
 
@@ -62,20 +57,7 @@ const ViewAlbum = ({
62
57
  const [openedImgIndex, setOpenedImgIndex] = useState(null);
63
58
  const [openedImg, setOpenedImg] = useState(null);
64
59
 
65
- const [centerContext, setCenterContext] = useState(<ViewAlbum preview={true} album={album} />)
66
-
67
- const formChanged = (values) => {
68
- setCenterContext(<ViewAlbum preview={true} album={album} {...values} />)
69
- }
70
60
 
71
- let tabs = [
72
- {
73
- title: 'New', id: 'preview'
74
- },
75
- {
76
- title: 'Context', id: 'community'
77
- }
78
- ]
79
61
 
80
62
 
81
63
  const handleUserKeyPress = useCallback(event => {
@@ -93,17 +75,18 @@ const ViewAlbum = ({
93
75
  }, [openedImgIndex, handleUserKeyPress]);
94
76
 
95
77
  const onIconClicked = (action) => {
96
- if(!props.preview){
78
+ if (!props.preview) {
97
79
  switch (action) {
98
- case 'add':
99
- setShowModal(true)
100
- break;
101
- case 'config':
102
- setShowConfigModal(true)
103
- break;
104
- default:
105
- break;
106
- }}
80
+ case 'add':
81
+ setShowModal(true)
82
+ break;
83
+ case 'config':
84
+ setShowConfigModal(true)
85
+ break;
86
+ default:
87
+ break;
88
+ }
89
+ }
107
90
  }
108
91
 
109
92
  const cardIconClicked = (action, index) => {
@@ -117,7 +100,7 @@ const ViewAlbum = ({
117
100
  props.addPhoto(photo)
118
101
  }
119
102
 
120
- const cancelHandler = () => {
103
+ const closeModal = () => {
121
104
  setShowModal(false)
122
105
  }
123
106
 
@@ -138,6 +121,11 @@ const ViewAlbum = ({
138
121
  }
139
122
  }
140
123
 
124
+ const closeImgModal = () => {
125
+ setShowImgModal(false)
126
+ setOpenedImgIndex(null)
127
+ }
128
+
141
129
  const cancelConfig = () => {
142
130
  setShowConfigModal(false);
143
131
  localStorage.removeItem('formStyles')
@@ -158,63 +146,27 @@ const ViewAlbum = ({
158
146
  customCardStyles={cardStyles}
159
147
  {...props} />
160
148
 
161
- <Modal
162
- modalIsOpen={showModal}
163
- closeModal={() => setShowModal(false)}
164
- exitModalButton={(e) => (
165
- <div></div>
166
- )}>
167
- <AddPhoto
168
- saveHandler={onAddPhoto}
169
- cancelHandler={cancelHandler}
170
- saveBtnText={props.saveBtnText || 'Add'}
171
- cancelBtnText={props.saveBtnText || 'Cancel'} />
172
- </Modal>
173
- <Modal
174
- modalIsOpen={showImgModal}
175
- closeModal={() => {
176
- setShowImgModal(false)
177
- setOpenedImgIndex(null)
178
- }}
179
- exitModalButton={(e) => (
180
- <div></div>
181
- )}
182
- width="70vw"
183
- height="90vh">
184
- <CloseIconContainer onClick={() => setShowImgModal(false)}>
185
- <AiOutlineClose />
186
- </CloseIconContainer>
187
- <LeftIconContainer onClick={prevPhoto}>
188
- <AiOutlineArrowLeft />
189
- </LeftIconContainer>
190
- <DetailedPhoto cardClicked={nextPhoto} img={openedImg} />
191
- <RightIconContainer onClick={nextPhoto}>
192
- <AiOutlineArrowRight />
193
- </RightIconContainer>
194
- </Modal>
195
- <Modal
196
- modalIsOpen={showConfigModal}
197
- closeModal={cancelConfig}
198
- exitModalButton={(e) => (
199
- <div></div>
200
- )}
201
- >
202
- <Tabs
203
- title="Photo Album Config"
204
- tabs={tabs}
205
- id='styling'
206
- >
207
- <PhotoAlbumPreview
208
- componentProps={{ album, title: props.title || 'Photo Album', preview: true }}
209
- formChanged={formChanged}
210
- id='preview'
211
- />
212
- <Community
213
- center={centerContext}
214
- community={community}
215
- id="community" />
216
- </Tabs>
217
- </Modal>
149
+ <AddPhotoModal
150
+ showModal={showModal}
151
+ onAddPhoto={onAddPhoto}
152
+ closeModal={closeModal}
153
+ saveBtnText={props.saveBtnText}
154
+ cancelBtnText={props.cancelBtnText}
155
+ />
156
+ <ShowImgModal
157
+ showImgModal={showImgModal}
158
+ closeModal={closeImgModal}
159
+ prevPhoto={prevPhoto}
160
+ nextPhoto={nextPhoto}
161
+ openedImg={openedImg}
162
+ />
163
+ <PhotoAlbumConfigModal
164
+ showConfigModal={showConfigModal}
165
+ cancelConfig={cancelConfig}
166
+ album={album}
167
+ community={community}
168
+ title={props.title}
169
+ />
218
170
  </Container>
219
171
  )
220
172
  }
@@ -223,53 +175,6 @@ const Container = styled.div`
223
175
 
224
176
  `
225
177
 
226
- const IconContainer = styled.div`
227
- width: 30px;
228
- height: 30px;
229
- background-color: #757575;
230
- position: absolute;
231
- transform: translateY(-50%);
232
- top: 50%;
233
- display: flex;
234
- justify-content: center;
235
- align-items: center;
236
- border-radius: 50rem;
237
- z-index: 999;
238
- cursor: pointer;
239
- opacity: .4;
240
- transition: all .2s;
241
-
242
- &:hover{
243
- opacity: 1;
244
- transform: scale(1.1) translateY(-50%);
245
- }
246
-
247
- svg{
248
- color: white;
249
- }
250
-
251
- `
252
-
253
- const CloseIconContainer = styled.div`
254
- position: absolute;
255
- z-index: 999;
256
- right: 10px;
257
- top: 10px;
258
- cursor: pointer;
259
-
260
- svg{
261
- color: white;
262
- }
263
- `
264
-
265
- const LeftIconContainer = styled(IconContainer)`
266
- left: 10px;
267
- `
268
-
269
- const RightIconContainer = styled(IconContainer)`
270
- right: 10px;
271
- `
272
-
273
178
  ViewAlbum.defaultProps = {
274
179
  headerBackground: '#FE1744',
275
180
  titleColor: 'white',