From 8091a360664f0b1bba8190ec1a059472b9cd3142 Mon Sep 17 00:00:00 2001 From: ChrisBrownie55 Date: Wed, 30 Dec 2020 19:24:43 -0500 Subject: [PATCH] Working on Share functionality --- .eslintcache | 1 - .gitignore | 3 + .idea/codestream.xml | 2 +- .idea/dictionaries/Christopher.xml | 1 + .idea/inspectionProfiles/Project_Default.xml | 1 + .idea/private-art-hub-project.iml | 10 +- .idea/runConfigurations/format.xml | 12 ++ .idea/runConfigurations/start.xml | 12 ++ README.md | 65 +++++-- package.json | 2 + .../{action-button.js => ActionButton.js} | 4 +- .../{error-boundary.js => BasicBoundary.js} | 0 src/components/{center.js => Center.js} | 0 src/components/CharacterCard.js | 50 ++--- src/components/CharacterCardList.js | 64 ++++++ src/components/Dialog.js | 29 +++ .../{page-transitions.js => FadeLayout.js} | 0 src/components/Loading.js | 11 ++ .../{notifications.js => Notifications.js} | 0 src/components/ProfileHeader.js | 86 ++++++++ .../{profile-menu.js => ProfileMenu.js} | 17 +- .../{profile-photo.js => ProfilePhoto.js} | 0 src/components/SaveDialog.js | 37 ++++ src/components/ShareDialog.js | 14 ++ ...ansition-router.js => TransitionRouter.js} | 0 src/components/auto-expanding-textarea.js | 61 ------ src/components/character-parts.js | 97 +++++----- src/components/saving-dialog.js | 61 ------ src/components/slideshow-parts.js | 14 +- src/index.js | 36 ++-- src/pages/404.js | 4 +- src/pages/character.js | 49 ++--- src/pages/edit-character.js | 48 +++-- src/pages/home.js | 180 +++++------------ src/pages/landing.js | 4 +- src/pages/{authentication.js => login.js} | 6 +- src/pages/new-character.js | 34 ++-- src/shared/firebase.js | 28 ++- src/shared/helpers.js | 46 +++++ src/shared/machines.js | 183 ++++++++++++++---- src/shared/resources.js | 1 - src/shared/theme.js | 2 + .../{action-button.css => ActionButton.css} | 0 .../{character-card.css => CharacterCard.css} | 18 +- src/styles/Dialog.css | 35 ++++ .../{profile-menu.css => ProfileMenu.css} | 0 src/styles/character.css | 4 + user-data-structure.txt | 21 -- yarn.lock | 22 +++ 49 files changed, 848 insertions(+), 527 deletions(-) delete mode 100644 .eslintcache create mode 100644 .idea/runConfigurations/format.xml create mode 100644 .idea/runConfigurations/start.xml rename src/components/{action-button.js => ActionButton.js} (83%) rename src/components/{error-boundary.js => BasicBoundary.js} (100%) rename src/components/{center.js => Center.js} (100%) create mode 100644 src/components/CharacterCardList.js create mode 100644 src/components/Dialog.js rename src/components/{page-transitions.js => FadeLayout.js} (100%) create mode 100644 src/components/Loading.js rename src/components/{notifications.js => Notifications.js} (100%) create mode 100644 src/components/ProfileHeader.js rename src/components/{profile-menu.js => ProfileMenu.js} (91%) rename src/components/{profile-photo.js => ProfilePhoto.js} (100%) create mode 100644 src/components/SaveDialog.js create mode 100644 src/components/ShareDialog.js rename src/components/{transition-router.js => TransitionRouter.js} (100%) delete mode 100644 src/components/auto-expanding-textarea.js delete mode 100644 src/components/saving-dialog.js rename src/pages/{authentication.js => login.js} (96%) rename src/styles/{action-button.css => ActionButton.css} (100%) rename src/styles/{character-card.css => CharacterCard.css} (75%) create mode 100644 src/styles/Dialog.css rename src/styles/{profile-menu.css => ProfileMenu.css} (100%) delete mode 100644 user-data-structure.txt diff --git a/.eslintcache b/.eslintcache deleted file mode 100644 index 9545f09..0000000 --- a/.eslintcache +++ /dev/null @@ -1 +0,0 @@ -[{"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\index.js":"1","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\serviceWorker.js":"2","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\landing.js":"3","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\character.js":"4","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\home.js":"5","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\404.js":"6","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\transition-router.js":"7","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\authentication.js":"8","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\error-boundary.js":"9","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\center.js":"10","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\firebase.js":"11","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\theme.js":"12","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\new-character.js":"13","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\action-button.js":"14","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\CharacterCard.js":"15","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\profile-menu.js":"16","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\notifications.js":"17","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\auto-expanding-textarea.js":"18","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\saving-dialog.js":"19","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\machines.js":"20","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\profile-photo.js":"21","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\helpers.js":"22","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\errors.js":"23","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\resources.js":"24","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\slideshow-parts.js":"25","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\character-parts.js":"26","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\page-transitions.js":"27","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\edit-character.js":"28","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\empty.js":"29"},{"size":2785,"mtime":1608943371586,"results":"30","hashOfConfig":"31"},{"size":4602,"mtime":1594516065119,"results":"32","hashOfConfig":"31"},{"size":466,"mtime":1608868884660,"results":"33","hashOfConfig":"31"},{"size":3705,"mtime":1608958387878,"results":"34","hashOfConfig":"31"},{"size":4478,"mtime":1608842255022,"results":"35","hashOfConfig":"31"},{"size":840,"mtime":1608860849174,"results":"36","hashOfConfig":"31"},{"size":505,"mtime":1608839435364,"results":"37","hashOfConfig":"31"},{"size":5157,"mtime":1608958387834,"results":"38","hashOfConfig":"31"},{"size":893,"mtime":1594516064792,"results":"39","hashOfConfig":"31"},{"size":291,"mtime":1609016032237,"results":"40","hashOfConfig":"31"},{"size":4510,"mtime":1608958388062,"results":"41","hashOfConfig":"31"},{"size":1862,"mtime":1608759848430,"results":"42","hashOfConfig":"31"},{"size":2314,"mtime":1608943650226,"results":"43","hashOfConfig":"31"},{"size":683,"mtime":1608839405773,"results":"44","hashOfConfig":"31"},{"size":1578,"mtime":1608926099114,"results":"45","hashOfConfig":"31"},{"size":5359,"mtime":1608759910823,"results":"46","hashOfConfig":"31"},{"size":182,"mtime":1607895056959,"results":"47","hashOfConfig":"31"},{"size":1584,"mtime":1609015954337,"results":"48","hashOfConfig":"31"},{"size":1637,"mtime":1607895057050,"results":"49","hashOfConfig":"31"},{"size":10062,"mtime":1609020176636,"results":"50","hashOfConfig":"31"},{"size":1922,"mtime":1608384645639,"results":"51","hashOfConfig":"31"},{"size":1821,"mtime":1608951226050,"results":"52","hashOfConfig":"31"},{"size":894,"mtime":1595961850556,"results":"53","hashOfConfig":"31"},{"size":2908,"mtime":1608996747116,"results":"54","hashOfConfig":"31"},{"size":6864,"mtime":1609028206824,"results":"55","hashOfConfig":"31"},{"size":4199,"mtime":1609016032246,"results":"56","hashOfConfig":"31"},{"size":183,"mtime":1608842254808,"results":"57","hashOfConfig":"31"},{"size":2235,"mtime":1609016159570,"results":"58","hashOfConfig":"31"},{"size":59,"mtime":1609028207027,"results":"59","hashOfConfig":"31"},{"filePath":"60","messages":"61","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1jdzda6",{"filePath":"62","messages":"63","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"65","messages":"66","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"67","messages":"68","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":"69","usedDeprecatedRules":"64"},{"filePath":"70","messages":"71","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"72","usedDeprecatedRules":"64"},{"filePath":"73","messages":"74","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"75","messages":"76","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"77","messages":"78","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"79","messages":"80","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"81","messages":"82","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"83","messages":"84","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"85","messages":"86","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"87","messages":"88","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"89","usedDeprecatedRules":"64"},{"filePath":"90","messages":"91","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"92","usedDeprecatedRules":"64"},{"filePath":"93","messages":"94","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"95","messages":"96","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"97","messages":"98","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"99","messages":"100","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"101","messages":"102","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"103","messages":"104","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"105","messages":"106","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"107","messages":"108","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"109","messages":"110","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"111","messages":"112","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"113","messages":"114","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"115","messages":"116","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"117","usedDeprecatedRules":"64"},{"filePath":"118","messages":"119","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"120","messages":"121","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"122","messages":"123","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\index.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\serviceWorker.js",[],["124","125"],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\landing.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\character.js",["126","127","128","129","130","131"],"import {useMemo, useState} from 'react'\n\nimport {useMachine} from '@xstate/react'\nimport {useParams, useHistory} from 'react-router-dom'\nimport * as firebase from 'firebase'\n\nimport {\n\tfetchImageURL,\n\tfirestore,\n\tstorage,\n\tuseCharacterWithImages,\n\tuseUser,\n\twithUserResource,\n} from '../shared/firebase.js'\nimport {ActionButton} from '../components/action-button.js'\nimport {plainSlideshowMachine} from '../shared/machines.js'\nimport {createDocumentResource, createResource, useDocumentResource} from '../shared/resources.js'\nimport {artworkStyles, artworkWrapperStyles, NextButton, PreviousButton} from '../components/slideshow-parts.js'\nimport {CharacterStory, CharacterLayout} from '../components/character-parts.js'\n\nimport '../styles/character.css'\nimport {FadeLayout} from '../components/page-transitions'\nimport {Center} from '../components/center'\nimport {Spinner} from '@fluentui/react'\n\nfunction CharacterSlideshow({context, send, resources}) {\n\tif (resources.length === 0) return null\n\n\tconst url = resources[context.currentPage].read()\n\tconst previous = send('PREVIOUS')} />\n\tconst next = send('NEXT')} />\n\n\t// TODO: add real alt from character data\n\treturn (\n\t\t
\n\t\t\t{context.currentPage > 0 ? previous : null}\n\t\t\t\"Artwork\"\n\t\t\t{context.currentPage < context.numberOfImages - 1 ? next : null}\n\t\t
\n\t)\n}\n\n/**\n * @param {{userRef: DocumentRef, resource: ResourceReader}} props\n * @constructor\n */\nexport function CharacterPage() {\n\tconst {characterID: id} = useParams()\n\tconst {character, imageResources} = useCharacterWithImages(id)\n\n\tconst [slideshowState, send] = useMachine(\n\t\tplainSlideshowMachine.withContext({\n\t\t\t...plainSlideshowMachine.context,\n\t\t\tnumberOfImages: imageResources.length,\n\t\t}),\n\t)\n\n\tconst history = useHistory()\n\tfunction back() {\n\t\thistory.replace('/')\n\t}\n\n\tfunction edit() {\n\t\thistory.push(`/edit-character/${id}`)\n\t}\n\n\tconst {uid} = useUser()\n\tconst [status, setStatus] = useState('viewing')\n\tfunction deleteCharacter() {\n\t\tsetStatus('deleting')\n\n\t\t// Delete artwork first\n\t\tconst promises = []\n\t\tfor (const fileID of character.files) {\n\t\t\tpromises.push(\n\t\t\t\tstorage\n\t\t\t\t\t.ref()\n\t\t\t\t\t.child(`${uid}/${fileID}`)\n\t\t\t\t\t.delete()\n\t\t\t\t\t.catch(error => console.warn(`Failed to delete art ${uid}/${fileID}:`, error))\n\t\t\t)\n\t\t}\n\n\t\t// Then delete the character itself\n\t\tconst ref = firestore.collection('users').doc(uid)\n\t\tpromises.push(\n\t\t\tref\n\t\t\t\t.update({characters: firebase.firestore.FieldValue.arrayRemove(character)})\n\t\t\t\t.catch(error => console.warn(`Failed to delete character ${id}:`, error))\n\t\t)\n\n\t\tPromise.all(promises).finally(() => {\n\t\t\thistory.replace('/')\n\t\t})\n\t}\n\n\tif (status === 'deleting') {\n\t\treturn (\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t)\n\t}\n\n\treturn (\n\t\t}\n\t\t\tname={

{character.name}

}\n\t\t\tstory={}\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t\n\t\t\t\t\t\tDelete\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\tBack\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\tEdit\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t/>\n\t)\n}\n","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\home.js",["132","133","134"],"import {Suspense, unstable_SuspenseList as SuspenseList, useEffect, useState} from 'react'\n\nimport {useHistory} from 'react-router-dom'\nimport {motion} from 'framer-motion'\nimport {Text, Spinner} from '@fluentui/react'\n\nimport {Center} from '../components/center'\nimport {ActionButton} from '../components/action-button'\nimport {CharacterCard} from '../components/CharacterCard'\nimport {ProfileMenu, ProfileMenuItem} from '../components/profile-menu'\n\nimport {colors} from '../shared/theme'\nimport {auth, firestore, useCharacters, useUser} from '../shared/firebase.js'\nimport {createDocumentResource, useDocumentResource} from '../shared/resources.js'\n\nimport '../styles/profile-menu.css'\nimport 'wicg-inert'\n\n/**\n * @typedef {{\n * characterID: string,\n * files: [string],\n * name: string,\n * story: string\n * }} Character\n * @typedef {{characters: [Character]}} UserData\n */\n\n/**\n * Renders a list of ``'s from a document and a resource.\n * @param {{\n * \tdocumentRef: DocumentReference,\n * \tresource: ResourceReader\n * }} props\n * @returns {JSX.Element|[JSX.Element]}\n * @constructor\n */\nfunction CharacterCardList({documentRef, resource}) {\n\tconst characters = useCharacters()\n\n\t// Render all the Character Cards if there are any.\n\tif (characters.length > 0) {\n\t\tconst listOfCharacters = characters.map((character, index) => )\n\t\treturn (\n\t\t\t\n\t\t\t\t{listOfCharacters}\n\t\t\t\n\t\t)\n\t}\n\n\t// Otherwise, inform the user of how to create a character.\n\t// TODO: Add alt for pride-drawing.svg\n\treturn (\n\t\t\n\t\t\t\"\"\n\t\t\t\n\t\t\t\tTo get started, add some characters with the \"New\" button.\n\t\t\t\n\t\t\n\t)\n}\n\n/**\n * Renders the Home page's header with the profile image. It handles scroll animations.\n * @returns {JSX.Element}\n * @constructor\n */\nfunction ProfileHeader() {\n\tconst user = useUser()\n\tconst [status, setStatus] = useState('flat')\n\n\tuseEffect(() => {\n\t\tfunction handler() {\n\t\t\tsetStatus(prevStatus => {\n\t\t\t\tif (window.scrollY > 0) return 'floating'\n\t\t\t\treturn 'flat'\n\t\t\t})\n\t\t}\n\n\t\twindow.addEventListener('scroll', handler)\n\t\treturn () => {\n\t\t\twindow.removeEventListener('scroll', handler)\n\t\t}\n\t}, [])\n\n\tconst history = useHistory()\n\tfunction signOut() {\n\t\tauth.signOut().then(() => {\n\t\t\thistory.push('/login')\n\t\t})\n\t}\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t💛 Art Hub\n\t\t\t\n\t\t\t\n\t\t\t\tShare\n\t\t\t\tSettings\n\t\t\t\tHelp\n\t\t\t\tSign Out\n\t\t\t\n\t\t\n\t)\n}\n\n/**\n * Home page\n * @returns {JSX.Element}\n * @constructor\n */\nexport function Home() {\n\tconst history = useHistory()\n\tfunction openNewCharacterPage() {\n\t\thistory.push('/new-character')\n\t}\n\n\treturn (\n\t\t\n\t\t\t\n\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\tNew\n\t\t\t\t\n\t\t\t
\n\t\t\n\t)\n}\n","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\404.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\transition-router.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\authentication.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\error-boundary.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\center.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\firebase.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\theme.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\new-character.js",["135","136"],"import {useEffect, useState} from 'react'\nimport {useMachine} from '@xstate/react'\nimport {useHistory} from 'react-router-dom'\nimport {useId} from '@uifabric/react-hooks'\nimport {FontIcon, Text} from '@fluentui/react'\nimport {useDropzone} from 'react-dropzone'\n\nimport {ActionButton} from '../components/action-button.js'\nimport {SavingDialog} from '../components/saving-dialog.js'\nimport {useUser} from '../shared/firebase.js'\nimport {newCharacterMachine, uploadSlideshowMachine} from '../shared/machines.js'\nimport {\n\tartistSVGStyles,\n\tartworkStyles,\n\tartworkWrapperStyles,\n\tdropZoneMessages,\n\tNextButton,\n\tPreviousButton,\n\tremoveButtonStyles,\n} from '../components/slideshow-parts.js'\nimport {\n\tCharacterLayout,\n\tCharacterNameInput,\n\tCharacterStoryInput,\n\tclearStorageKeys,\n} from '../components/character-parts.js'\n\nimport {colors} from '../shared/theme.js'\nimport '../styles/new-character.css'\n\nfunction useSlideshow() {\n\tconst [state, send] = useMachine(uploadSlideshowMachine)\n\tconst dropzone = useDropzone({\n\t\taccept: 'image/*',\n\t\tonDropAccepted(acceptedFiles) {\n\t\t\t// handle cancelled file operations\n\t\t\tconst filesWithPreview = acceptedFiles.map(file => {\n\t\t\t\tfile.preview = URL.createObjectURL(file)\n\t\t\t\treturn file\n\t\t\t})\n\t\t\tsend('ADDED_PHOTOS', {data: filesWithPreview})\n\t\t},\n\t})\n\n\tconst previousButton = send('PREVIOUS')} />\n\tconst nextButton = send('NEXT')} />\n\n\tlet slideshowSection\n\tif (state.matches('noPhotos'))\n\t\tslideshowSection = (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t)\n\telse if (state.matches('newPhoto'))\n\t\t// TODO: Make drop target accessible\n\t\tslideshowSection = (\n\t\t\t
\n\t\t\t\t{previousButton}\n\t\t\t\t\n\t\t\t
\n\t\t)\n\telse if (state.matches('photos'))\n\t\tslideshowSection = (\n\t\t\t
\n\t\t\t\t{state.context.currentPage > 0 && previousButton}\n\t\t\t\t\"\"\n\t\t\t\t send('REMOVED_PHOTO')}\n\t\t\t\t\tstyle={removeButtonStyles}\n\t\t\t\t/>\n\t\t\t\t{nextButton}\n\t\t\t
\n\t\t)\n\n\tlet dropMessageContent\n\tif (dropzone.isDragReject) dropMessageContent = dropZoneMessages.rejected\n\telse if (dropzone.isDragAccept) dropMessageContent = dropZoneMessages.accepted\n\telse dropMessageContent = dropZoneMessages.idle\n\n\tconst dropID = useId('drop')\n\tlet dropMessage\n\t/* TODO: align center on Desktop sizes */\n\tif (state.matches('photos'))\n\t\tdropMessage = (\n\t\t\t\n\t\t\t\tEdit your character photos above.\n\t\t\t\n\t\t)\n\telse\n\t\tdropMessage = (\n\t\t\t\n\t\t\t\t{dropMessageContent}\n\t\t\t\n\t\t)\n\n\treturn {\n\t\t...dropzone,\n\t\tdropID,\n\t\tdropMessage,\n\t\tslideshowSection,\n\t\tfiles: state.context.files,\n\t}\n}\n\nexport function NewCharacter() {\n\tconst [name, setName] = useState(localStorage.getItem('character-name') ?? '')\n\tconst [story, setStory] = useState(localStorage.getItem('character-story') ?? '')\n\n\tconst user = useUser()\n\tconst {getInputProps, slideshowSection, dropMessage, dropID, files} = useSlideshow()\n\n\tconst history = useHistory()\n\tfunction cancel() {\n\t\tclearStorageKeys('character-name', 'character-story')\n\t\thistory.replace('/')\n\t}\n\n\tconst [saveState, send] = useMachine(newCharacterMachine)\n\tfunction save(event) {\n\t\tevent.preventDefault()\n\t\tsend('SAVE', {name, story, files, uid: user.uid})\n\t}\n\n\tuseEffect(() => {\n\t\tif (saveState.matches({finished: 'success'})) {\n\t\t\tclearStorageKeys('character-name', 'character-story')\n\t\t\thistory.push(`/character/${saveState.context.characterID}`)\n\t\t}\n\t}, [history, saveState])\n\n\treturn (\n\t\t\n\t\t\t\t\t{slideshowSection}\n\t\t\t\t\t\n\t\t\t\t\t{dropMessage}\n\t\t\t\t\n\t\t\t}\n\t\t\tname={}\n\t\t\tstory={}\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t\n\t\t\t\t\t\tCancel\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\tSave\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t>\n\t\t\t\n\t\t\n\t)\n}\n","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\action-button.js",["137","138"],"import {FontIcon, Text} from '@fluentui/react'\nimport {motion} from 'framer-motion'\nimport {colors} from '../shared/theme'\nimport '../styles/action-button.css'\n\n/*\n * @param {{ variant: 'round' | 'flat' | 'bold-orange' | 'bold-pink' | 'danger', iconName: string }} options\n */\nexport function ActionButton({variant, iconName, children, className, ...props}) {\n\treturn (\n\t\t\n\t\t\t\n\t\t\t{children && (\n\t\t\t\t\n\t\t\t\t\t{children}\n\t\t\t\t\n\t\t\t)}\n\t\t\n\t)\n}\n","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\CharacterCard.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\profile-menu.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\notifications.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\auto-expanding-textarea.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\saving-dialog.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\machines.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\profile-photo.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\helpers.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\errors.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\resources.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\slideshow-parts.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\character-parts.js",["139"],"import {memo, Suspense, useState} from 'react'\n\nimport xss from 'xss'\nimport marked from 'marked'\nimport {Label, Spinner} from '@fluentui/react'\n\nimport {Center} from './center.js'\nimport {colors} from '../shared/theme.js'\nimport {artworkWrapperStyles} from './slideshow-parts.js'\nimport {FadeLayout} from './page-transitions'\nimport {AutoExpandingTextarea} from './auto-expanding-textarea'\nimport {debounce} from 'mini-debounce'\nimport {useId} from '@uifabric/react-hooks'\n\nexport const CharacterStory = memo(({story}) => (\n\t
\n))\n\nconst empty = {}\n/**\n * A component to facilitate in reduction of repeating layout code for pages that display character info.\n *\n * @param {{\n * mode: 'display',\n * slideshow: JSX.Element,\n * name: JSX.Element,\n * story: JSX.Element,\n * actions: [JSX.Element],\n * children: any,\n * } | {\n * mode: 'edit',\n * onSubmit: function(React.SyntheticEvent),\n * slideshow: JSX.Element,\n * name: JSX.Element,\n * story: JSX.Element,\n * actions: [JSX.Element],\n * children: any,\n * }} props\n * @constructor\n */\nexport function CharacterLayout({slideshow, name, story, actions, mode, onSubmit, children}) {\n\tconst content = (\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{slideshow}\n\t\t\t\t\n\n\t\t\t\t
\n\t\t\t\t\t{name}\n\t\t\t\t\t{story}\n\t\t\t\t
\n\t\t\t
\n\t\t\t\n\t\t\t\t{actions}\n\t\t\t\n\t\t\n\t)\n\n\tlet wrapped\n\tif (mode === 'display') {\n\t\twrapped = (\n\t\t\t\n\t\t\t\t{content}\n\t\t\t\t{children}\n\t\t\t\n\t\t)\n\t} else if (mode === 'edit') {\n\t\twrapped = (\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\t{content}\n\t\t\t\t
\n\t\t\t\t{children}\n\t\t\t
\n\t\t)\n\t} else {\n\t\tthrow new Error(`Invalid mode '${mode}' is not supported.`)\n\t}\n\n\treturn wrapped\n}\n\nexport function CharacterInput({className, multiline, label, ...props}) {\n\tconst [status, setStatus] = useState('idle')\n\tconst focusHandlers = {\n\t\tonFocus() {\n\t\t\tsetStatus('focus')\n\t\t},\n\t\tonBlur() {\n\t\t\tsetStatus('idle')\n\t\t},\n\t}\n\n\treturn (\n\t\t
\n\t\t\t{label && (\n\t\t\t\t\n\t\t\t)}\n\t\t\t{multiline ? (\n\t\t\t\t\n\t\t\t) : (\n\t\t\t\t\n\t\t\t)}\n\t\t
\n\t)\n}\n\nconst debouncedSetItem = debounce((key, value) => localStorage.setItem(key, value), 100)\nexport function createValueStorer(key, setter) {\n\treturn event => {\n\t\tconst {value} = event.target\n\n\t\tsetter(value)\n\t\tdebouncedSetItem(key, value)\n\t}\n}\n\nexport function CharacterNameInput({storageKey, setter, value}) {\n\tconst id = useId('name')\n\treturn (\n\t\t\n\t)\n}\nexport function CharacterStoryInput({storageKey, setter, value}) {\n\tconst id = useId('story')\n\treturn (\n\t\t\n\t)\n}\n\nexport function clearStorageKeys(...keys) {\n\tfor (const key of keys) {\n\t\tlocalStorage.setItem(key, '')\n\t}\n}\n","C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\components\\page-transitions.js",[],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\pages\\edit-character.js",["140","141","142","143","144"],"C:\\Users\\Christopher\\Workspace\\private-art-hub-project\\src\\shared\\empty.js",[],{"ruleId":"145","replacedBy":"146"},{"ruleId":"147","replacedBy":"148"},{"ruleId":"149","severity":1,"message":"150","line":1,"column":9,"nodeType":"151","messageId":"152","endLine":1,"endColumn":16},{"ruleId":"149","severity":1,"message":"153","line":8,"column":2,"nodeType":"151","messageId":"152","endLine":8,"endColumn":15},{"ruleId":"149","severity":1,"message":"154","line":13,"column":2,"nodeType":"151","messageId":"152","endLine":13,"endColumn":18},{"ruleId":"149","severity":1,"message":"155","line":17,"column":9,"nodeType":"151","messageId":"152","endLine":17,"endColumn":31},{"ruleId":"149","severity":1,"message":"156","line":17,"column":33,"nodeType":"151","messageId":"152","endLine":17,"endColumn":47},{"ruleId":"149","severity":1,"message":"157","line":17,"column":49,"nodeType":"151","messageId":"152","endLine":17,"endColumn":68},{"ruleId":"149","severity":1,"message":"158","line":13,"column":15,"nodeType":"151","messageId":"152","endLine":13,"endColumn":24},{"ruleId":"149","severity":1,"message":"155","line":14,"column":9,"nodeType":"151","messageId":"152","endLine":14,"endColumn":31},{"ruleId":"149","severity":1,"message":"157","line":14,"column":33,"nodeType":"151","messageId":"152","endLine":14,"endColumn":52},{"ruleId":"149","severity":1,"message":"159","line":14,"column":2,"nodeType":"151","messageId":"152","endLine":14,"endColumn":16},{"ruleId":"149","severity":1,"message":"160","line":18,"column":2,"nodeType":"151","messageId":"152","endLine":18,"endColumn":19},{"ruleId":"149","severity":1,"message":"161","line":2,"column":9,"nodeType":"151","messageId":"152","endLine":2,"endColumn":15},{"ruleId":"149","severity":1,"message":"162","line":3,"column":9,"nodeType":"151","messageId":"152","endLine":3,"endColumn":15},{"ruleId":"149","severity":1,"message":"163","line":19,"column":7,"nodeType":"151","messageId":"152","endLine":19,"endColumn":12},{"ruleId":"149","severity":1,"message":"164","line":1,"column":9,"nodeType":"151","messageId":"152","endLine":1,"endColumn":18},{"ruleId":"149","severity":1,"message":"165","line":3,"column":9,"nodeType":"151","messageId":"152","endLine":3,"endColumn":14},{"ruleId":"149","severity":1,"message":"166","line":28,"column":63,"nodeType":"151","messageId":"152","endLine":28,"endColumn":68},{"ruleId":"149","severity":1,"message":"167","line":28,"column":70,"nodeType":"151","messageId":"152","endLine":28,"endColumn":87},{"ruleId":"149","severity":1,"message":"168","line":41,"column":9,"nodeType":"151","messageId":"152","endLine":41,"endColumn":12},"no-native-reassign",["169"],"no-negated-in-lhs",["170"],"no-unused-vars","'useMemo' is defined but never used.","Identifier","unusedVar","'fetchImageURL' is defined but never used.","'withUserResource' is defined but never used.","'createDocumentResource' is defined but never used.","'createResource' is defined but never used.","'useDocumentResource' is defined but never used.","'firestore' is defined but never used.","'CharacterInput' is defined but never used.","'createValueStorer' is defined but never used.","'motion' is defined but never used.","'colors' is defined but never used.","'empty' is assigned a value but never used.","'useEffect' is defined but never used.","'useId' is defined but never used.","'files' is assigned a value but never used.","'preExistingPhotos' is assigned a value but never used.","'uid' is assigned a value but never used.","no-global-assign","no-unsafe-negation"] \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4d29575..9381162 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ npm-debug.log* yarn-debug.log* yarn-error.log* + +# Generated by CRA (eslint internally) +.eslintcache diff --git a/.idea/codestream.xml b/.idea/codestream.xml index be78838..ff544a2 100644 --- a/.idea/codestream.xml +++ b/.idea/codestream.xml @@ -2,6 +2,6 @@ \ No newline at end of file diff --git a/.idea/dictionaries/Christopher.xml b/.idea/dictionaries/Christopher.xml index d58302d..33088fc 100644 --- a/.idea/dictionaries/Christopher.xml +++ b/.idea/dictionaries/Christopher.xml @@ -1,6 +1,7 @@ + lumiére storer diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 4ff6fc9..10da9bf 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,6 +1,7 @@ diff --git a/.idea/private-art-hub-project.iml b/.idea/private-art-hub-project.iml index 05aefab..4154697 100644 --- a/.idea/private-art-hub-project.iml +++ b/.idea/private-art-hub-project.iml @@ -1,13 +1,7 @@ - + - - - - - - + - \ No newline at end of file diff --git a/.idea/runConfigurations/format.xml b/.idea/runConfigurations/format.xml new file mode 100644 index 0000000..e9e2ed1 --- /dev/null +++ b/.idea/runConfigurations/format.xml @@ -0,0 +1,12 @@ + + + + + +