Skip to content

jinhanloh2021/dothack-web-cms

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

.Hack Website

Website for SMU .Hack developer student club
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Configuration
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgments

About The Project

.Hack

(back to top)

Built With

  • Next
  • Typescript
  • Tailwind
  • Vercel
  • Sanity

(back to top)

Getting Started

Prerequisites

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

Installation

  1. Clone the repo
    git clone https://github.com/jinhanloh2021/dothack-web-cms.git
  2. Install NPM packages
    npm install

Run Locally

  1. Run dev server
    npm run dev

(back to top)

Usage

To access the Sanity Studio CMS, go to the admin route https://localhost:3000/admin to edit posts.

(back to top)

Configuration

Current exco display

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.

Events Pagination

Number of events displayed per page is hardcoded to 6. This can be changed in the file.

(back to top)

Roadmap

  • Dark mode
  • See open issues for a full list of proposed features (and known issues)

(back to top)

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch from the dev branch
git checkout dev
git checkout -b feat/issue-id/MyProposedFeature
  1. Commit your Changes (git commit -m 'feat #issue-id : ' -m 'I have added this feature successfully')
  2. Push to the Branch (git push origin feat/issue-id/MyProposedFeature)
  3. Open a Pull Request to dev branch

Branching and commit rules

See the rules for this repo here

(back to top)

License

Distributed under the MIT License.

(back to top)

Contact

Project Link: https://github.com/jinhanloh2021/dothack-web-cms

Email: jinhan.loh.2021@scis.smu.edu.sg

(back to top)

Acknowledgments

(back to top)

About

Website for SMU .Hack student developer club. Built with NextJS13 and content powered by Sanity IO.

Topics

Resources

License

Stars

Watchers

Forks