Website for SMU .Hack developer student club
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
This is an example of how to list things you need to use the software and how to install them.
- npm
npm install npm@latest -g
- Clone the repo
git clone https://github.com/jinhanloh2021/dothack-web-cms.git
- Install NPM packages
npm install
- Run dev server
npm run dev
To access the Sanity Studio CMS, go to the admin route https://localhost:3000/admin to edit posts.
The getCurrentCoreExco() query gets the current core exco members to be displayed on the home screen.
export async function getCurrentCoreExco(): Promise<ExcoQuery[]> {
return createClient(clientConfig).fetch(
groq`*[_type == 'exco' && (position == 'President' || position == 'Vice President (internal)' || position == 'Vice President (external)' || position == 'Honorary General Secretary' || position == 'Honorary Finance Secretary') && term == "${getCurrentAY()}"] | order(term desc, position){
name,
position,
term,
'imageSrc': profile_pic.asset->url, // -> to dereference
'lqip': profile_pic.asset->metadata.lqip,
'hotspot': profile_pic.hotspot,
}`
);
}The positions are hardcoded, and their term has to match the getCurrentAY() term. Eg. The current term is AY22/23, so only exco members with attribute term equal to AY22/23 will be queried.
export function getCurrentAY(): string {
const currentYear = new Date().getFullYear(); // Assume elections in September
if (new Date().getMonth() < 8) {
return `AY${(currentYear - 1) % 100}/${currentYear % 100}`;
} else {
return `AY${currentYear % 100}/${(currentYear + 1) % 100}`;
}
}This has the assumption that the elections are in September, so the new term starts in September. Eg. 09/23 -> AY22/23, 10/23 -> AY23/24. To adjust which exco is displayed, you can either change this value in the function, or adjust the term attribute in the CMS for each exco.
Number of events displayed per page is hardcoded to 6. This can be changed in the file.
- Dark mode
- See open issues for a full list of proposed features (and known issues)
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star.
- Fork the Project
- Create your Feature Branch from the
devbranch
git checkout dev
git checkout -b feat/issue-id/MyProposedFeature- Commit your Changes (
git commit -m 'feat #issue-id : ' -m 'I have added this feature successfully') - Push to the Branch (
git push origin feat/issue-id/MyProposedFeature) - Open a Pull Request to
devbranch
See the rules for this repo here
Distributed under the MIT License.
Project Link: https://github.com/jinhanloh2021/dothack-web-cms