-
Notifications
You must be signed in to change notification settings - Fork 0
/
component---src-pages-account-jsx-a1f67f2b80db7b7e73c8.js.map
1 lines (1 loc) · 21.3 KB
/
component---src-pages-account-jsx-a1f67f2b80db7b7e73c8.js.map
1
{"version":3,"sources":["webpack:///./src/components/Dialog/ConfirmDialog.jsx","webpack:///./src/components/Org/Card.jsx","webpack:///./src/components/Org/NewCard.jsx","webpack:///./src/pages/account.jsx","webpack:///./src/utils/permissions.js"],"names":["Button","text","handler","primary","css","padding","borderRadius","fontSize","fontWeight","backgroundColor","color","transition","cursor","onClick","title","message","okText","okHandler","cancelText","cancelHandler","overlay","React","useRef","dialog","useEffect","current","style","opacity","transform","ref","code","name","icon","createdAt","permissions","created","Date","toDateString","toLocaleTimeString","to","alt","src","height","width","Permission","OWNER","ADMIN","connect","state","me","global","useState","processing","setProcessing","undefined","success","setSuccess","confirmMessage","setConfirmMessage","orgs","setOrgs","isBrowser","window","fetch","process","headers","Accept","Authorization","token","then","res","ok","json","Error","statusText","catch","e","console","error","Helmet","description","id","login","email","display","gap","gridRowGap","gridTemplateColumns","map","org","Card","key","NewCard","Loader","disabled","length","ConfirmDialog","method","navigate","MEMBER","AUTHOR"],"mappings":"4IAEMA,EAAS,SAAC,GAAD,IAAGC,EAAH,EAAGA,KAAMC,EAAT,EAASA,QAASC,EAAlB,EAAkBA,QAAlB,OACX,mBACIC,IAAG,YAAE,CACDC,QAAS,YACTC,aAAcH,EAAU,EAAI,EAC5BI,SAAU,OACVC,WAAY,IACZC,gBAAiBN,EAAU,0BAA4B,OACvDO,MAAO,YACPC,WAAY,4CACZC,OAAQ,UACR,SAAU,CACNF,MAAO,kBAGfG,QAAUX,GAERD,I,q3BAIK,gBAAuE,IAApEa,EAAmE,EAAnEA,MAAOC,EAA4D,EAA5DA,QAASC,EAAmD,EAAnDA,OAAQC,EAA2C,EAA3CA,UAAWC,EAAgC,EAAhCA,WAAYC,EAAoB,EAApBA,cACvDC,EAAUC,IAAMC,OAAO,MACvBC,EAAS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BAEQI,EAAK6B,KAAI,SAAAC,GAAG,OACR,YAACC,EAAD,CACIC,IAAMF,EAAI3D,KACVA,KAAO2D,EAAI3D,KACXC,KAAO0D,EAAI1D,KACXC,KAAOyD,EAAIzD,KACXC,UAAYwD,EAAIxD,UAChBC,YAAcuD,EAAIvD,iBAI9B,YAAC0D,EAAD,QAEQ,IAAZrC,EACI,mBAAKnD,IAAG,GAAR,+DACA,YAACyF,EAAA,EAAD,QAKpB,mBAAKzF,IAAG,GAOJ,mBAAKA,IAAG,GAAR,eACA,mBAAKA,IAAG,GAAR,oTAGA,mBAAKA,IAAG,GAGJ,sBACI0F,SAAW1C,GAAcO,EAAKoC,OAC9B3F,IAAG,EAUHS,QAAU,kBAAM6C,EAAkB,0EAG9BN,EAAa,WAAa,kBAI9BO,EAAKoC,OACD,mBAAK3F,IAAG,GAAR,oFAOA,OAMZqD,EACI,YAACuC,EAAA,EAAD,CACIlF,MAAQ,iBACRC,QAAU0C,EACVxC,UA/ME,WACdmC,GACAO,EAAKoC,SAET1C,GAAc,GACdK,EAAkB,IAEbG,eAELC,OAAOC,MAAMC,qCAAgC,CACzCiC,OAAQ,SACRhC,QAAS,CACL,OAAU,mBACV,cAAiBhB,EAAGmB,SAEzBC,MAAK,SAAAC,GACJ,GAAIA,EAAIC,GAAI,OAAOD,EAAIE,OACvB,MAAM,IAAIC,MAAMH,EAAII,eACrBL,MAAK,WACJhB,GAAc,GACd6C,YAAS,gBACVvB,OAAM,SAACC,GACNC,QAAQC,MAAMF,GACdvB,GAAc,QAyLFlC,cAAgB,kBAAMuC,EAAkB,OAE5C,U,oCCpOpB,kCAAO,IAAMd,EAAa,CACtBC,MAAO,EACPC,MAAO,EACPqD,OAAQ,EACRC,OAAQ","file":"component---src-pages-account-jsx-a1f67f2b80db7b7e73c8.js","sourcesContent":["import React from \"react\";\n\nconst Button = ({ text, handler, primary }) => (\n <div\n css={{\n padding: \"10px 20px\",\n borderRadius: primary ? 3 : 0,\n fontSize: \".8em\",\n fontWeight: 500,\n backgroundColor: primary ? \"rgba(100, 100, 100, .3)\" : \"none\",\n color: \"lightgrey\",\n transition: \"color var(--transition-default-time) ease\",\n cursor: \"pointer\",\n \":hover\": {\n color: \"var(--green)\",\n },\n }}\n onClick={ handler }\n >\n { text }\n </div>\n);\n\nexport default ({ title, message, okText, okHandler, cancelText, cancelHandler }) => {\n const overlay = React.useRef(null);\n const dialog = React.useRef(null);\n\n React.useEffect(() => {\n overlay.current.style.opacity = 1;\n dialog.current.style.transform = \"scale(1)\";\n }, []);\n\n return (\n <div\n ref={ overlay }\n style={{\n opacity: 0,\n }}\n css={{\n position: \"fixed\",\n top: 0,\n left: 0,\n height: \"100vh\",\n width: \"100vw\",\n backgroundColor: \"rgba(0, 0, 0, .8)\",\n zIndex: 42,\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n fontSize: \".9em\",\n transition: \"opacity var(--transition-default-time) ease\",\n \"@supports (backdrop-filter: blur())\": {\n backgroundColor: \"rgba(0, 0, 0, .5)\",\n backdropFilter: \"blur(15px)\",\n },\n }}\n >\n <div\n ref={ dialog }\n style={{\n transform: \"scale(0.5)\",\n }}\n css={{\n maxWidth: 400,\n borderRadius: 3,\n backgroundColor: \"rgba(35, 35, 35, 1)\",\n boxShadow: \"0px 15px 50px -10px black\",\n transition: \"transform var(--transition-default-time) ease\",\n }}\n >\n <div css={{\n padding: 20,\n }}>\n <div css={{\n marginBottom: 10,\n fontWeight: 600,\n textTransform: \"uppercase\",\n }}>\n { title }\n </div>\n <div>{ message }</div>\n </div>\n <div css={{\n padding: 15,\n marginTop: 15,\n display: \"flex\",\n flexWrap: \"wrap\",\n justifyContent: \"flex-end\",\n borderBottomLeftRadius: 3,\n borderBottomRightRadius: 3,\n backgroundColor: \"rgba(15, 15, 15, .8)\",\n }}>\n <Button text={ cancelText || \"No\" } handler={ cancelHandler } />\n <Button text={ okText || \"Yes\" } handler={ okHandler } primary={ true } />\n </div>\n </div>\n </div>\n );\n};\n","import React from \"react\";\nimport { RiSettings2Line } from \"react-icons/ri\";\nimport { Link } from \"gatsby\";\n\nimport { Permission } from \"../../utils/permissions\";\n\nexport default ({ code, name, icon, createdAt, permissions }) => {\n createdAt = new Date(createdAt);\n let created = createdAt.toDateString() === new Date().toDateString() ? createdAt.toLocaleTimeString() : createdAt.toDateString();\n\n return (\n <Link to={ \"/\" + code }>\n <div css={{\n padding: 15,\n display: \"flex\",\n flexDirection: \"column\",\n backgroundColor: \"rgba(100, 100, 100, .2)\",\n transition: \"background-color var(--transition-default-time) ease-out\",\n borderRadius: 3,\n \":hover\": {\n backgroundColor: \"rgba(100, 100, 100, .3)\",\n },\n }}>\n <div css={{\n display: \"flex\",\n alignItems: \"center\",\n marginBottom: 15,\n }}>\n {\n icon\n ? <img\n alt=\"\"\n src={ icon }\n height={ 64 }\n width={ 64 }\n css={{\n marginRight: 15,\n }}\n />\n : null\n }\n <div css={{\n fontSize: \".9em\",\n }}>\n { name }\n </div>\n </div>\n <div css={{\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n }}>\n <div css={{\n fontSize: \".7em\",\n color: \"grey\",\n }}>\n { created }\n </div>\n <div css={{\n display: \"flex\",\n justifyContent: \"flex-end\",\n \"svg\": {\n color: \"grey\",\n transition: \"color var(--transition-default-time) ease-out\",\n },\n \":hover svg:hover\": {\n color: \"white\",\n },\n }}>\n {\n (permissions === Permission.OWNER || permissions === Permission.ADMIN) && (\n <Link to={ \"/\" + code + \"/settings\" }>\n <RiSettings2Line />\n </Link>\n )\n }\n </div>\n </div>\n </div>\n </Link>\n );\n};\n","import React from \"react\";\nimport { IoIosAddCircleOutline } from \"react-icons/io\";\nimport { Link } from \"gatsby\";\n\nexport default () => (\n <Link to={ \"/new\" } css={{\n color: \"grey\",\n \":hover\": {\n color: \"var(--light)\",\n },\n }}>\n <div css={{\n height: 130,\n padding: 15,\n display: \"flex\",\n alignItems: \"center\",\n transition: \"box-shadow var(--transition-default-time) ease-in-out\",\n boxShadow: \"0 0 0px 2px rgba(100, 100, 100, .2) inset\",\n borderRadius: 3,\n \":hover\": {\n boxShadow: \"0 0 0px 2px rgba(100, 100, 100, .3) inset\",\n },\n }}>\n <IoIosAddCircleOutline css={{\n marginRight: 15,\n padding: 5,\n fontSize: 64,\n }} />\n <div css={{\n fontSize: \".9em\",\n }}>\n Create a new organization\n </div>\n </div>\n </Link>\n);\n","import React from \"react\";\nimport { connect } from \"react-redux\";\nimport { navigate } from \"gatsby\";\n\nimport Helmet from \"../components/Helmet\";\nimport ConfirmDialog from \"../components/Dialog/ConfirmDialog\";\nimport Loader from \"../components/Loader\";\nimport Card from \"../components/Org/Card\";\nimport NewCard from \"../components/Org/NewCard\";\nimport isBrowser from \"../utils/isBrowser\";\n\nconst AccountPage = ({ me }) => {\n const [ processing, setProcessing ] = React.useState(false);\n const [ success, setSuccess ] = React.useState(undefined);\n const [ confirmMessage, setConfirmMessage ] = React.useState(\"\");\n\n const [ orgs, setOrgs ] = React.useState([]);\n\n const deleteAccount = () => {\n if (processing) return;\n if (orgs.length) return;\n\n setProcessing(true);\n setConfirmMessage(\"\");\n\n if (!isBrowser()) return;\n\n window.fetch(process.env.API_URL + \"/login\", {\n method: \"DELETE\",\n headers: {\n \"Accept\": \"application/json\",\n \"Authorization\": me.token,\n },\n }).then(res => {\n if (res.ok) return res.json();\n throw new Error(res.statusText);\n }).then(() => {\n setProcessing(false);\n navigate(\"/sayonara\");\n }).catch((e) => {\n console.error(e);\n setProcessing(false);\n });\n };\n\n React.useEffect(() => {\n if (!isBrowser()) return;\n\n window.fetch(process.env.API_URL + \"/orgs\", {\n headers: {\n Accept: \"application/json\",\n Authorization: me.token,\n },\n }).then(res => {\n if (res.ok) return res.json();\n throw new Error(res.statusText);\n }).then(orgs => {\n setSuccess(true);\n setOrgs(orgs);\n }).catch((e) => {\n console.error(e);\n setSuccess(false);\n });\n }, [ me.token ]);\n\n return (\n <>\n <Helmet\n title=\"Account\"\n description=\"Manage your Glee account and organizations.\"\n />\n <div>\n <div css={{\n marginBottom: 5,\n fontSize: \"1.2em\",\n fontWeight: 500,\n }}>\n Profile\n </div>\n <div css={{\n marginBottom: 25,\n color: \"lightgrey\",\n }}>\n <div>Your profile data is synced with your GitHub account.</div>\n <div>Update them in GitHub and you'll see the changes next time you login.</div>\n </div>\n <div css={{\n display: \"flex\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n }}>\n <img\n alt=\"Avatar\"\n src={ \"https://avatars2.githubusercontent.com/u/\" + me.id + \"?size=256\" }\n width={ 128 }\n height={ 128 }\n css={{\n borderRadius: 3,\n marginRight: 15,\n }}\n />\n <div>\n <div>\n <div css={{\n color: \"darkgrey\",\n fontSize: \".8em\",\n fontWeight: 500,\n textTransform: \"uppercase\",\n }}>\n User\n </div>\n <div>{ me.name || me.login }</div>\n </div>\n <div css={{ marginTop: 10 }}>\n <div css={{\n color: \"darkgrey\",\n fontSize: \".8em\",\n fontWeight: 500,\n textTransform: \"uppercase\",\n }}>\n Email\n </div>\n <div>{ me.email }</div>\n </div>\n </div>\n </div>\n </div>\n\n <div css={{\n marginTop: 50,\n }}>\n <div css={{\n marginBottom: 5,\n fontSize: \"1.2em\",\n fontWeight: 500,\n }}>\n Organizations\n </div>\n <div css={{\n marginBottom: 25,\n color: \"lightgrey\",\n }}>\n You are a member of these organizations.\n </div>\n <div css={{\n display: \"grid\",\n gap: 15,\n gridRowGap: 15,\n gridTemplateColumns: `repeat(${ success ? \"auto-fill\" : \"auto-fit\" }, minmax(250px, 1fr))`,\n }}>\n {\n success === true\n ? <>\n {\n orgs.map(org =>\n <Card\n key={ org.code }\n code={ org.code }\n name={ org.name }\n icon={ org.icon }\n createdAt={ org.createdAt }\n permissions={ org.permissions }\n />\n )\n }\n <NewCard />\n </>\n : success === false\n ? <div css={{ fontSize: \".8em\", color: \"darkgrey\" }}>Oh, crap! Our servers having some issues. Please try again.</div>\n : <Loader />\n }\n </div>\n </div>\n\n <div css={{\n marginTop: 50,\n padding: 15,\n border: \"2px solid var(--red)\",\n borderRadius: 3,\n backgroundColor: \"rgba(255, 69, 58, .1)\",\n }}>\n <div css={{ fontSize: \".9em\", marginBottom: 5 }}>Danger Zone</div>\n <div css={{ color: \"lightgrey\", fontSize: \".8em\", marginBottom: 15 }}>\n When you delete your account, we'll remove the connection to your GitHub account, And then anonymize this account so that this account cannot be linked back to you. This way we preserve the votes, comments, or posts made by you in an organization without having to store your data. This cannot be undone.\n </div>\n <div css={{\n width: \"100%\",\n }}>\n <button\n disabled={ processing || orgs.length }\n css={{\n fontSize: \".8em\",\n backgroundColor: \"var(--red)\",\n color: \"var(--light)\",\n \":disabled\": {\n backgroundColor: \"darkred\",\n color: \"lightgrey\",\n cursor: \"not-allowed\",\n },\n }}\n onClick={ () => setConfirmMessage(\"Are you sure you want to delete your account? This cannot be undone.\") }\n >\n {\n processing ? \"Deleting\" : \"Delete Account\"\n }\n </button>\n {\n orgs.length\n ? <div css={{\n marginTop: 10,\n fontSize: \".8em\",\n color: \"var(--red)\",\n }}>\n You cannot delete your account as long as you're the owner of any organizations.\n </div>\n : null\n }\n </div>\n </div>\n\n {\n confirmMessage\n ? <ConfirmDialog\n title={ \"Delete Account\" }\n message={ confirmMessage }\n okHandler={ deleteAccount }\n cancelHandler={ () => setConfirmMessage(\"\") }\n />\n : null\n }\n </>\n );\n}\n\nexport default connect(\n state => ({ me: state.global.me }),\n)(AccountPage);\n","export const Permission = {\n OWNER: 1 << 0,\n ADMIN: 1 << 1,\n MEMBER: 1 << 2,\n AUTHOR: 1 << 3,\n};\n"],"sourceRoot":""}