08c223bc17d4710ab184bb4123030d2f.json 11.8 KB
Newer Older
1
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\reportForm\\\\assign\\\\Assign.js\",\n    _s = $RefreshSig$();\n\nimport React, { useState } from 'react';\nimport \"./assign.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Assign = () => {\n  _s();\n\n  const personalProjects = [{\n    id: \"MyApp\",\n    type: \"personal\"\n  }, {\n    id: \"MyOtherApp\",\n    type: \"personal\"\n  }];\n  const sharedProjects = [{\n    id: \"ReactApp\",\n    type: \"shared\",\n    teams: [{\n      name: \"Henriks Meme Machine\"\n    }]\n  }, {\n    id: \"Very big ReactApp\",\n    type: \"shared\",\n    teams: [{\n      name: \"Aubergine\"\n    }]\n  }];\n  const [appState, changeState] = useState({\n    activeObjects: [],\n    rootDirectoryObjects: [{\n      id: \"Personal projects\"\n    }, {\n      id: \"Shared projects\"\n    }]\n  });\n\n  const toggleActive = (directory, index) => {\n    const newArray = [];\n\n    if (directory[index] === newArray[index]) {\n      changeState({ ...appState,\n        activeObjects: null\n      });\n    } else {\n      newArray.push(directory[index]);\n      changeState({ ...appState,\n        activeObjects: newArray\n      });\n      console.log(appState.activeObjects);\n    }\n  };\n\n  const toggleActiveStyles = (directory, index) => {\n    if (directory[index] === appState.activeObjects) {\n      return \"active\";\n    } else return \"inactive\";\n  };\n\n  const RootDirectoryItems = parentDirectories => {\n    return /*#__PURE__*/_jsxDEV(\"ul\", {\n      className: \"rootDirectory\",\n      children: parentDirectories.map((elements, index) => /*#__PURE__*/_jsxDEV(\"li\", {\n        children: [/*#__PURE__*/_jsxDEV(\"div\", {\n          className: toggleActiveStyles(parentDirectories, index),\n          onClick: () => {\n            toggleActive(parentDirectories, index);\n          },\n          children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n            icon: \"folder\",\n            className: \"folder-icon\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 45,\n            columnNumber: 15\n          }, this), /*#__PURE__*/_jsxDEV(\"a\", {\n            children: [\"\\xA0 \", parentDirectories[index].id, \" \\xA0\"]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 46,\n            columnNumber: 15\n          }, this), /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n            icon: \"chevron-right\",\n            className: \"arrow-right-icon\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 47,\n            columnNumber: 15\n          }, this)]\n        }, index, true, {\n          fileName: _jsxFileName,\n          lineNumber: 44,\n          columnNumber: 13\n        }, this), parentDirectories[index] === appState.activeObjects ? parentDirectories[index] === 0 ? SubDirectoryItems(personalProjects) : SubDirectoryItems(sharedProjects) : null]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 43,\n        columnNumber: 11\n      }, this))\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 41,\n      columnNumber: 7\n    }, this);\n  };\n\n  const SubDirectoryItems = directory => {\n    return /*#__PURE__*/_jsxDEV(\"ul\", {\n      className: \"projectListDirectory\",\n      children: directory.map((elements, index) => /*#__PURE__*/_jsxDEV(\"li\", {\n        children: /*#__PURE__*/_jsxDEV(\"div\", {\n          className: toggleActiveStyles(directory, index),\n          onClick: () => {\n            toggleActive(directory, index);\n          },\n          children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n            icon: \"folder\",\n            className: \"folder-icon\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 66,\n            columnNumber: 15\n          }, this), /*#__PURE__*/_jsxDEV(\"a\", {\n            children: [\"\\xA0 \", directory[index].id, \" \\xA0\"]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 67,\n            columnNumber: 15\n          }, this), /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n            icon: \"chevron-right\",\n            className: \"arrow-right-icon\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 68,\n            columnNumber: 15\n          }, this)]\n        }, index, true, {\n          fileName: _jsxFileName,\n          lineNumber: 65,\n          columnNumber: 13\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 64,\n        columnNumber: 11\n      }, this))\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 62,\n      columnNumber: 7\n    }, this);\n  };\n\n  return /*#__PURE__*/_jsxDEV(\"div\", {\n    className: \"assignSelectContainer\",\n    children: RootDirectoryItems(appState.rootDirectoryObjects)\n  }, void 0, false, {\n    fileName: _jsxFileName,\n    lineNumber: 77,\n    columnNumber: 5\n  }, this);\n};\n\n_s(Assign, \"G9VHBYFRMM2vunD5OUCIV/YwKNw=\");\n\n_c = Assign;\nexport default Assign;\n\nvar _c;\n\n$RefreshReg$(_c, \"Assign\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/reportForm/assign/Assign.js"],"names":["React","useState","FontAwesomeIcon","Assign","personalProjects","id","type","sharedProjects","teams","name","appState","changeState","activeObjects","rootDirectoryObjects","toggleActive","directory","index","newArray","push","console","log","toggleActiveStyles","RootDirectoryItems","parentDirectories","map","elements","SubDirectoryItems"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;AACA,OAAO,cAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;;;AAEA,MAAMC,MAAM,GAAG,MAAM;AAAA;;AACnB,QAAMC,gBAAgB,GAAG,CACvB;AAAEC,IAAAA,EAAE,EAAE,OAAN;AAAeC,IAAAA,IAAI,EAAE;AAArB,GADuB,EAEvB;AAAED,IAAAA,EAAE,EAAE,YAAN;AAAoBC,IAAAA,IAAI,EAAE;AAA1B,GAFuB,CAAzB;AAKA,QAAMC,cAAc,GAAG,CACrB;AAAEF,IAAAA,EAAE,EAAE,UAAN;AAAkBC,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C;AAAkE,UAAA,OAAO,EAAE,MAAM;AAAEF,YAAAA,YAAY,CAACC,SAAD,EAAYC,KAAZ,CAAZ;AAAgC,WAAnH;AAAA,kCACE,QAAC,eAAD;AAAiB,YAAA,IAAI,EAAC,QAAtB;AAA+B,YAAA,SAAS,EAAC;AAAzC;AAAA;AAAA;AAAA;AAAA,kBADF,eAEE;AAAA,gCAAWD,SAAS,CAACC,KAAD,CAAT,CAAiBX,EAA5B;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF,eAGE,QAAC,eAAD;AAAiB,YAAA,IAAI,EAAC,eAAtB;AAAsC,YAAA,SAAS,EAAC;AAAhD;AAAA;AAAA;AAAA;AAAA,kBAHF;AAAA,WAAUW,KAAV;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cADD;AADH;AAAA;AAAA;AAAA;AAAA,YADF;AAaD,GAdD;;AAgBA,sBACE;AAAK,IAAA,SAAS,EAAC,uBAAf;AAAA,cACGM,kBAAkB,CAACZ,QAAQ,CAACG,oBAAV;AADrB;AAAA;AAAA;AAAA;AAAA,UADF;AAKD,CA5ED;;GAAMV,M;;KAAAA,M;AA8EN,eAAeA,MAAf","sourcesContent":["import React, { useState } from 'react'\r\nimport \"./assign.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst Assign = () => {\r\n  const personalProjects = [\r\n    { id: \"MyApp\", type: \"personal\" },\r\n    { id: \"MyOtherApp\", type: \"personal\" }\r\n  ]\r\n\r\n  const sharedProjects = [\r\n    { id: \"ReactApp\", type: \"shared\", teams: [{ name: \"Henriks Meme Machine\" }] },\r\n    { id: \"Very big ReactApp\", type: \"shared\", teams: [{ name: \"Aubergine\" }] }\r\n  ]\r\n\r\n  const [appState, changeState] = useState({\r\n    activeObjects: [],\r\n    rootDirectoryObjects: [{ id: \"Personal projects\" }, { id: \"Shared projects\" }]\r\n  })\r\n\r\n  const toggleActive = (directory, index) => {\r\n    const newArray = []\r\n    if (directory[index] === newArray[index]) {\r\n      changeState({ ...appState, activeObjects: null })\r\n    }\r\n    else {\r\n      newArray.push(directory[index])\r\n      changeState({ ...appState, activeObjects: newArray })\r\n      console.log(appState.activeObjects)\r\n    }\r\n  }\r\n\r\n  const toggleActiveStyles = (directory, index) => {\r\n    if (directory[index] === appState.activeObjects) {\r\n      return \"active\"\r\n    } else return \"inactive\"\r\n  }\r\n\r\n  const RootDirectoryItems = (parentDirectories) => {\r\n    return (\r\n      < ul className=\"rootDirectory\" >\r\n        {parentDirectories.map((elements, index) => (\r\n          <li>\r\n            <div key={index} className={toggleActiveStyles(parentDirectories, index)} onClick={() => { toggleActive(parentDirectories, index) }} >\r\n              <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n              <a>&nbsp; {parentDirectories[index].id} &nbsp;</a>\r\n              <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n            </div>\r\n            {\r\n              parentDirectories[index] === appState.activeObjects ?\r\n                parentDirectories[index] === 0 ? SubDirectoryItems(personalProjects) : SubDirectoryItems(sharedProjects) :\r\n                null\r\n            }\r\n          </li>\r\n        ))}\r\n      </ul >\r\n    )\r\n  }\r\n\r\n  const SubDirectoryItems = (directory) => {\r\n    return (\r\n      <ul className=\"projectListDirectory\">\r\n        {directory.map((elements, index) => (\r\n          <li>\r\n            <div key={index} className={toggleActiveStyles(directory, index)} onClick={() => { toggleActive(directory, index) }} >\r\n              <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n              <a>&nbsp; {directory[index].id} &nbsp;</a>\r\n              <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n            </div>\r\n          </li>\r\n        ))}\r\n      </ul >\r\n    )\r\n  }\r\n\r\n  return (\r\n    <div className=\"assignSelectContainer\">\r\n      {RootDirectoryItems(appState.rootDirectoryObjects)}\r\n    </div >\r\n  )\r\n}\r\n\r\nexport default Assign"]},"metadata":{},"sourceType":"module"}