mirror of
https://github.com/tjsga/tj-sga-website-react.git
synced 2025-04-03 20:00:17 -04:00
1 line
14 KiB
Plaintext
1 line
14 KiB
Plaintext
{"version":3,"file":"static/js/255.cb78c6ae.chunk.js","mappings":"qIAAe,SAASA,EAAaC,GAKH,IALI,SACrCC,KACGC,GAG2BF,EAC9B,OACCG,EAAAA,EAAAA,KAAA,MAAIC,UAAU,UAAWF,EAAKD,SAC5BA,GAGJ,C,8CCTe,SAASI,EAAIL,GAMxB,IANyB,SAC5BM,EAAW,mBAAkB,QAC7BC,EAAU,cAIVP,EACA,OACCQ,EAAAA,EAAAA,MAAA,OAAKJ,UAAU,OAAMH,SAAA,EACpBE,EAAAA,EAAAA,KAAA,QAAMC,UAAU,eAAcH,SAAEM,KAChCJ,EAAAA,EAAAA,KAAA,OACCM,IAAKH,EACLI,IAAI,aACJC,MAAO,CACNC,MAAO,QACPC,UAAW,OACXC,UAAW,eAKhB,C,gBCvBe,SAASC,EACvBC,EACAC,GAEA,MAAMC,EAAc,CAAC,EACrB,IAAK,MAAM,IAAEC,EAAG,KAAEC,KAAUJ,EAC3BE,EAAYC,GAAOF,EAAUI,WAAWC,GAAUA,IAAUF,IAG7D,OAAOJ,EAAQO,MAAK,CAACC,EAAGC,KACvB,IAAIC,EAAiBR,EAAYM,EAAEL,KAAOD,EAAYO,EAAEN,KACxD,OAAuB,IAAnBO,EACIA,EAEHF,EAAEG,KAAOF,EAAEE,MACN,EACEH,EAAEG,KAAOF,EAAEE,KACd,EAEA,CAET,GAEF,C,sFCpBe,SAASC,EAAYC,EAAeC,GAClD,IAAKC,EAAQC,GAAaC,EAAAA,WAM1B,OAJAA,EAAAA,WAAgB,KACfC,EAAAA,EAAOC,MAAMN,EAAOC,GAAQM,KAAKJ,EAAU,GACzC,CAACH,EAAOC,IAEJC,CACR,C,kECRA,MAAMM,EAAUC,IAAgBJ,EAAAA,GAMjB,SAASK,EAASC,GAChC,OAAOH,EAAQI,MAAMD,EACtB,C,iECTe,SAASE,EA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AAAA,KAAA,QAAAF,SACEwE,EAAMH,KAAItE,IAAA,IAAC,KAAEgE,EAAI,QAAEhD,EAAO,SAAEgE,EAAQ,iBAAEC,GAAkBjF,EAAA,OACxDQ,EAAAA,EAAAA,MAAA4D,EAAAA,SAAA,CAAAnE,SAAA,EACCO,EAAAA,EAAAA,MAACT,EAAAA,EAAa,CAACY,MAAO,CAAEiD,UAAW,UAAW3D,SAAA,CAAC,iBAC/B+D,KAGfgB,IACAxE,EAAAA,EAAAA,MAAA,OACCG,MAAO,CACNC,MAAO,OACP+B,QAAS,OACTyC,cAAe,SACfC,aAAc,UACbpF,SAAA,EAEFE,EAAAA,EAAAA,KAAA,OAAKQ,MAAO,CAAEiD,UAAW,SAAU0B,aAAc,QAASrF,UACzDE,EAAAA,EAAAA,KAAA,OACCM,IAAKuE,EACLtE,IAAK,iCAAmCsD,EACxCrD,MAAO,CAAEE,UAAW,aAGtBV,EAAAA,EAAAA,KAAA,QAAMQ,MAAO,CAAEiD,UAAW,UAAW3D,UACpCE,EAAAA,EAAAA,KAAC+D,EAAgB,CAACC,KAAsB,OAAhBc,QAAgB,IAAhBA,EAAAA,EAAoB,UAK9CjE,EAAQsD,KAAKjB,IACblD,EAAAA,EAAAA,KAACiD,EAAAA,EAAS,CACTE,kBAAgB,EAEhBD,OAAQA,GADHA,EAAOlC,SAIZ,QAKR,C","sources":["components/PrimaryHeader.tsx","components/Hero.tsx","lib/sortCommittee.ts","hooks/useQuery.ts","lib/imageUrl.ts","components/ConstrainedImage.tsx","components/RowItemHeader.tsx","components/RowItemSubheader.tsx","components/MemberRow.tsx","components/LineBreakToBrTag.tsx","pages/classcouncil.tsx"],"sourcesContent":["export default function PrimaryHeader({\r\n\tchildren,\r\n\t...props\r\n}: {\r\n\tchildren: React.ReactNode;\r\n} & JSX.IntrinsicElements['h1']) {\r\n\treturn (\r\n\t\t<h1 className='my-4' {...props}>\r\n\t\t\t{children}\r\n\t\t</h1>\r\n\t);\r\n}\r\n","import '../css/hero.css';\r\n\r\nexport default function Hero({\r\n\timageURL = '/images/hero.jpg',\r\n\theading = 'TJHSST SGA',\r\n}: {\r\n\timageURL?: string;\r\n\theading?: string;\r\n}) {\r\n\treturn (\r\n\t\t<div className='hero'>\r\n\t\t\t<span className='hero-heading'>{heading}</span>\r\n\t\t\t<img\r\n\t\t\t\tsrc={imageURL}\r\n\t\t\t\talt='Background'\r\n\t\t\t\tstyle={{\r\n\t\t\t\t\twidth: '100vw',\r\n\t\t\t\t\tmaxHeight: '60vh',\r\n\t\t\t\t\tobjectFit: 'contain',\r\n\t\t\t\t}}\r\n\t\t\t/>\r\n\t\t</div>\r\n\t);\r\n}\r\n","export default function sortCommittee(\r\n\tmembers: SGA.MemberDocument[],\r\n\troleOrder: string[]\r\n) {\r\n\tconst roleIndexes = {};\r\n\tfor (const { _id, role } of members) {\r\n\t\troleIndexes[_id] = roleOrder.findIndex((role_) => role_ === role);\r\n\t}\r\n\r\n\treturn members.sort((a, b) => {\r\n\t\tlet roleDifference = roleIndexes[a._id] - roleIndexes[b._id];\r\n\t\tif (roleDifference !== 0) {\r\n\t\t\treturn roleDifference;\r\n\t\t} else {\r\n\t\t\tif (a.name < b.name) {\r\n\t\t\t\treturn -1;\r\n\t\t\t} else if (a.name > b.name) {\r\n\t\t\t\treturn 1;\r\n\t\t\t} else {\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n","import React from 'react';\r\nimport sanity from '../sanity';\r\n\r\nexport default function useQuery<T>(query: string, params?: any) {\r\n\tlet [result, setResult] = React.useState<T>();\r\n\r\n\tReact.useEffect(() => {\r\n\t\tsanity.fetch(query, params).then(setResult);\r\n\t}, [query, params]);\r\n\r\n\treturn result;\r\n}\r\n","import { default as ImageUrlBuilder } from '@sanity/image-url';\r\nimport sanity from '../sanity';\r\n\r\nconst builder = ImageUrlBuilder(sanity);\r\n\r\n/**\r\n * Build a URL for an image based on specified attributes\r\n * @param {SanityImageSource} source The source image\r\n */\r\nexport default function imageUrl(source: any) {\r\n\treturn builder.image(source);\r\n}\r\n","import { CSSProperties } from 'react';\r\n\r\nexport default function ConstrainedImage({\r\n\talt,\r\n\tsrc,\r\n\tstyle,\r\n}: {\r\n\talt: string;\r\n\tsrc: string;\r\n\tstyle?: CSSProperties;\r\n}) {\r\n\treturn (\r\n\t\t<div\r\n\t\t\tstyle={{\r\n\t\t\t\t// required: center the image with flexbox\r\n\t\t\t\tdisplay: 'flex',\r\n\t\t\t\tjustifyContent: 'center',\r\n\t\t\t\talignItems: 'center',\r\n\t\t\t\toverflow: 'hidden',\r\n\t\t\t\t...style,\r\n\t\t\t}}\r\n\t\t>\r\n\t\t\t<img\r\n\t\t\t\tsrc={src}\r\n\t\t\t\talt={alt}\r\n\t\t\t\tstyle={{\r\n\t\t\t\t\tminWidth: '100%',\r\n\t\t\t\t\tminHeight: '100%',\r\n\t\t\t\t\tflexShrink: 0,\r\n\t\t\t\t\tobjectFit: 'cover',\r\n\t\t\t\t}}\r\n\t\t\t/>\r\n\t\t</div>\r\n\t);\r\n}\r\n","export default function RowItemHeader({\r\n\tchildren,\r\n}: {\r\n\tchildren: React.ReactNode;\r\n}) {\r\n\treturn <h3 className='header'>{children}</h3>;\r\n}\r\n","export default function RowItemSubheader({ children }) {\r\n\treturn <i>{children}</i>;\r\n}\r\n","import '../css/article.css';\r\nimport imageUrl from '../lib/imageUrl';\r\nimport ConstrainedImage from './ConstrainedImage';\r\nimport RowItemHeader from './RowItemHeader';\r\nimport RowItemSubheader from './RowItemSubheader';\r\n\r\nexport default function MemberRow({\r\n\tmember,\r\n\tlimitPhotoHeight = false,\r\n}: {\r\n\tmember: SGA.MemberDocument;\r\n\tlimitPhotoHeight?: boolean;\r\n}) {\r\n\tlet thumbnail = member.profile_photo\r\n\t\t? imageUrl(member.profile_photo).url()\r\n\t\t: undefined;\r\n\r\n\treturn (\r\n\t\t<div className='d-flex my-4'>\r\n\t\t\t<div style={{ flex: 1, textAlign: 'right' }}>\r\n\t\t\t\t{thumbnail ? (\r\n\t\t\t\t\tlimitPhotoHeight ? (\r\n\t\t\t\t\t\t<ConstrainedImage\r\n\t\t\t\t\t\t\tsrc={thumbnail}\r\n\t\t\t\t\t\t\talt={member.name}\r\n\t\t\t\t\t\t\tstyle={{\r\n\t\t\t\t\t\t\t\tmarginLeft: 'auto',\r\n\t\t\t\t\t\t\t\tmarginRight: '2em',\r\n\t\t\t\t\t\t\t\twidth: '10em',\r\n\t\t\t\t\t\t\t\theight: '15em',\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t) : (\r\n\t\t\t\t\t\t<div style={{ marginLeft: 'auto', marginRight: '2em' }}>\r\n\t\t\t\t\t\t\t<img src={thumbnail} alt={member.name} />\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t)\r\n\t\t\t\t) : null}\r\n\t\t\t</div>\r\n\t\t\t<div style={{ flex: 3 }}>\r\n\t\t\t\t<RowItemHeader>{member.name}</RowItemHeader>\r\n\t\t\t\t<RowItemSubheader>\r\n\t\t\t\t\t{member.role}, {member.year}\r\n\t\t\t\t</RowItemSubheader>\r\n\t\t\t\t<br />\r\n\t\t\t\t<p>{member.bio}</p>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t);\r\n}\r\n","export default function LinebreakToBrTag({ text }: { text: string }) {\r\n\t// Must be wrapped in fragment to process react nodes correctly\r\n\treturn (\r\n\t\t<>\r\n\t\t\t{text.split('\\n').map((line) => (\r\n\t\t\t\t<>\r\n\t\t\t\t\t{line}\r\n\t\t\t\t\t<br />\r\n\t\t\t\t</>\r\n\t\t\t))}\r\n\t\t</>\r\n\t);\r\n}\r\n","import React from 'react';\r\nimport Hero from '../components/Hero';\r\nimport LinebreakToBrTag from '../components/LineBreakToBrTag';\r\nimport MemberRow from '../components/MemberRow';\r\nimport PrimaryHeader from '../components/PrimaryHeader';\r\nimport useQuery from '../hooks/useQuery';\r\nimport imageUrl from '../lib/imageUrl';\r\nimport sortCommittee from '../lib/sortCommittee';\r\n\r\nconst roleOrder = [\r\n\t'President',\r\n\t'Vice-President',\r\n\t'Treasurer',\r\n\t'Secretary',\r\n\t'Historian',\r\n\t'Senator',\r\n\t'Sponsor',\r\n];\r\n\r\nexport interface ClassCouncilYear {\r\n\tyear: string;\r\n\tmembers: SGA.MemberDocument[];\r\n\tphotoUrl: string | null;\r\n\tphotoDescription: string | null;\r\n}\r\n\r\nexport default function ClassCouncil() {\r\n\tlet members = useQuery<SGA.MemberDocument[]>(\r\n\t\t`*[_type == 'member' && committee == 'class'] | order year`\r\n\t);\r\n\r\n\tif (!members) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tlet years: ClassCouncilYear[] = [];\r\n\tlet currentYearMembers: SGA.MemberDocument[] = [];\r\n\tlet currentYear = '';\r\n\tlet currentYearPhotoUrl: string | null = null;\r\n\tlet currentYearPhotoDescription: string | null = null;\r\n\r\n\tconst saveCurrentYear = () => {\r\n\t\t// Clear the members of the current year\r\n\t\tyears.push({\r\n\t\t\tyear: currentYear,\r\n\t\t\tmembers: sortCommittee(currentYearMembers, roleOrder),\r\n\t\t\tphotoUrl: currentYearPhotoUrl,\r\n\t\t\tphotoDescription: currentYearPhotoDescription,\r\n\t\t});\r\n\r\n\t\tcurrentYearMembers = [];\r\n\t\tcurrentYearPhotoUrl = null;\r\n\t\tcurrentYear = '';\r\n\t};\r\n\r\n\tfor (let member of members) {\r\n\t\tif (member.year !== currentYear) {\r\n\t\t\tif (currentYear !== '') {\r\n\t\t\t\tsaveCurrentYear();\r\n\t\t\t}\r\n\t\t\tcurrentYear = member.year;\r\n\t\t}\r\n\t\t// If the role is 'PHOTO', 'Photo', 'photo', or anything else like that, use its \"profile picture\"\r\n\t\t// as this Class Council's group photo.\r\n\t\tif (member.role.toLowerCase() === 'photo') {\r\n\t\t\tcurrentYearPhotoUrl = imageUrl(member.profile_photo).url();\r\n\t\t\tcurrentYearPhotoDescription = member.bio;\r\n\t\t} else {\r\n\t\t\tcurrentYearMembers.push(member);\r\n\t\t}\r\n\t}\r\n\r\n\tif (currentYearMembers.length > 0) {\r\n\t\tsaveCurrentYear();\r\n\t}\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t<Hero heading='Class Council' />\r\n\t\t\t<main>\r\n\t\t\t\t{years.map(({ year, members, photoUrl, photoDescription }) => (\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t\t<PrimaryHeader style={{ textAlign: 'center' }}>\r\n\t\t\t\t\t\t\tClass Council {year}\r\n\t\t\t\t\t\t</PrimaryHeader>\r\n\r\n\t\t\t\t\t\t{photoUrl && (\r\n\t\t\t\t\t\t\t<div\r\n\t\t\t\t\t\t\t\tstyle={{\r\n\t\t\t\t\t\t\t\t\twidth: '100%',\r\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\r\n\t\t\t\t\t\t\t\t\tflexDirection: 'column',\r\n\t\t\t\t\t\t\t\t\talignContent: 'center',\r\n\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t<div style={{ textAlign: 'center', marginBottom: '10px' }}>\r\n\t\t\t\t\t\t\t\t\t<img\r\n\t\t\t\t\t\t\t\t\t\tsrc={photoUrl}\r\n\t\t\t\t\t\t\t\t\t\talt={'Group photo for Class Council ' + year}\r\n\t\t\t\t\t\t\t\t\t\tstyle={{ maxHeight: '25em' }}\r\n\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t<span style={{ textAlign: 'center' }}>\r\n\t\t\t\t\t\t\t\t\t<LinebreakToBrTag text={photoDescription ?? ''} />\r\n\t\t\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t)}\r\n\r\n\t\t\t\t\t\t{members.map((member) => (\r\n\t\t\t\t\t\t\t<MemberRow\r\n\t\t\t\t\t\t\t\tlimitPhotoHeight\r\n\t\t\t\t\t\t\t\tkey={member._id}\r\n\t\t\t\t\t\t\t\tmember={member}\r\n\t\t\t\t\t\t\t></MemberRow>\r\n\t\t\t\t\t\t))}\r\n\t\t\t\t\t</>\r\n\t\t\t\t))}\r\n\t\t\t</main>\r\n\t\t</>\r\n\t);\r\n}\r\n"],"names":["PrimaryHeader","_ref","children","props","_jsx","className","Hero","imageURL","heading","_jsxs","src","alt","style","width","maxHeight","objectFit","sortCommittee","members","roleOrder","roleIndexes","_id","role","findIndex","role_","sort","a","b","roleDifference","name","useQuery","query","params","result","setResult","React","sanity","fetch","then","builder","ImageUrlBuilder","imageUrl","source","image","ConstrainedImage","display","justifyContent","alignItems","overflow","minWidth","minHeight","flexShrink","RowItemHeader","RowItemSubheader","MemberRow","member","limitPhotoHeight","thumbnail","profile_photo","url","undefined","flex","textAlign","marginLeft","marginRight","height","year","bio","LinebreakToBrTag","text","_Fragment","split","map","line","ClassCouncil","years","currentYearMembers","currentYear","currentYearPhotoUrl","currentYearPhotoDescription","saveCurrentYear","push","photoUrl","photoDescription","toLowerCase","length","flexDirection","alignContent","marginBottom"],"sourceRoot":""} |