Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Development #98

Merged
merged 315 commits into from
Jan 16, 2024
Merged

Development #98

merged 315 commits into from
Jan 16, 2024

Conversation

Clumsy-Coder
Copy link
Owner

Summary

release v1.0.0

Description

release v1.0.0

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate)

Types of changes

  • New feature: (non-breaking change, which adds functionality)
  • Bug fix: (non-breaking change, which fixes an issue)
  • Performance: improvement
  • Documentation:
  • Style: (fix code formatting issues, whitespace, missing semicolon, rename variable etc)
  • Chore: (add changes that are not related to source code. Ex: changing eslint config)
  • Code refactor: (change working code without regressing features)
  • Test: (adding/updating tests)
  • Build: (changes that affect the build system. Ex: npm)
  • CI: (changes to the CI/CD configs and scripts)

Does this Pull Request introduce a breaking change?

  • yes
  • no

Checklist

  • The commit message follows conventional commits guidelines: https://www.conventionalcommits.org/en/v1.0.0/
  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

  ## what
  - add api endpoint `/api/poll`

  ## how

  ## why
  - this will be used get the latest problem submissions

  ## where
  - ./src/app/api/poll/route.ts

  ## usage
  ## what
  - change `Problem.status` type to `string`

  ## how

  ## why
  - the upstream api will return as a number
  - the NextJS api will convert number to a string

  ## where
  - ./src/types/index.ts

  ## usage
  ## what
  - add object `ProblemStatus`

  ## how

  ## why
  - will be used to convert `Problem` property `status` from a number to
    a string

  ## where
  - ./src/types/index.ts

  ## usage
  ## what
  - convert Problem `status` to a string
    - number
      - 0: Unavailable
      - 1: Normal
      - 2: Special Judge

  ## how
  - use object `ProblemStatus` from `@/types/index.ts` to convert a
    number into a string

  ## why
  - don't need the client side to convert the data

  ## where
  - ./src/app/api/problems/[problemNum]/route.ts
  - ./src/app/api/problems/route.ts

  ## usage
…blems/:problemNum`

  ## what
  - add docs on what the key is used for in endpoint `/api/problems/:problemNum`

  ## how
  - obtained from
    - https://uhunt.onlinejudge.org/api
      - `Problem List` section

  ## why
  - for better clarity

  ## where
  - ./src/app/api/problems/route.ts

  ## usage
…/poll`

  ## what
  - mutate the data returned from upstream for endpoint `/api/poll`
    - convert `verdict ID` to a string
      - use object to map through the IDs
    - convert `language ID` to a string
      - use object to map through the IDs
    - convert `rank` to a string
      - return '-' if rank below 0.
      - return the provided value if rank is above 0
    - add problem number as an object property
    - add problem title as an object property

  ## how
  - map through each element in the array

  ## why
  - better to do preprocessing server side than client side
    - ex: getting the `problem number` from `problem id`

  ## where
  - ./src/app/api/poll/route.ts

  ## usage
  ## what
  - move endpoint `/api/poll` to `/api/poll/:pollId`

  ## how

  ## why
  - this required because of the way polling works in the upstream api
  - the first time when polling the polling ID would be 0
  - after that the polling ID would be the latest `submission ID`

  ## where
  - ./src/app/api/poll/route.ts -> ./src/app/api/poll/[pollId]/route.ts

  ## usage
  ## what
  - add `Verdict` number to string map

  ## how

  ## why

  ## where
  - ./src/types/index.ts

  ## usage
  ## what
  - add `Language` number to string map

  ## how

  ## why

  ## where
  - ./src/types/index.ts

  ## usage
  ## what
  - add type `Submission`

  ## how

  ## why

  ## where
  - ./src/types/index.ts

  ## usage
  ## what
  - compile project to `ESNext`

  ## how

  ## why

  ## where
  - ./tsconfig.json

  ## usage
…erdictStr`

  ## what
  - convert `ver` number into string into property `verdictStr`

  ## how

  ## why
  - the property `ver` will be used assigning bg-color depending on the
    value

  ## where
  - ./src/app/api/poll/[pollId]/route.ts

  ## usage
  ## what
  - process submissions from endpoint `/api/poll/[pollId]`
    - reverse the array
    - group submissions by submission id (`sid`)
    - flatten the array of array
      - pick only the latest submission after grouping by `sid`
    - sort the array by submission time

  ## how

  ## why
  - the submissions contain duplicate entries
    - the first submission is in status of `In Queue`
    - the second submission is the processed submission with verdict

  ## where
  - ./src/app/api/poll/[pollId]/route.ts

  ## usage
  ## what
  - add padding to the main content

  ## how

  ## why

  ## where
  - ./src/app/layout.tsx

  ## usage
  ## what
  - add package `react-query`

  ## how

  ## why

  ## where
  - ./package-lock.json
  - ./package.json

  ## usage
  ## what
  - add Provider for `react-query`

  ## how
  - obtained from
    - https://tanstack.com/query/latest/docs/react/guides/advanced-ssr#server-components--nextjs-app-router

  ## why

  ## where
  - ./src/provider/ReactQuery.tsx

  ## usage
  ## what
  - use `react-query` provider

  ## how
  - obtained from
    - https://tanstack.com/query/latest/docs/react/guides/advanced-ssr#server-components--nextjs-app-router

  ## why

  ## where
  - ./src/app/layout.tsx

  ## usage
  ## what
  - add package `axios`

  ## how

  ## why

  ## where
  - ./package-lock.json
  - ./package.json

  ## usage
  ## what
  - add component `Table`

  ## how
  - run command
    npx shadcn-ui@latest add table

  ## why

  ## where
  - ./src/components/ui/table.tsx

  ## usage
  ## what
  - use `axios` to fetch data

  ## how

  ## why

  ## where
  - ./src/app/api/poll/[pollId]/route.ts

  ## usage
  ## what
  - merge duplicate `tailwind.config` files

  ## how

  ## why

  ## where
  - ./components.json
  - ./tailwind.config.js
  - ./tailwind.config.ts

  ## usage
  ## what
  - add react-query hook to fetch live submissions
    - provide
      - pollId
      - fetchInterval

  ## how

  ## why
  - this will be used to fetch live submissions in an interval

  ## where
  - ./src/hooks/index.ts

  ## usage
  ## what
  - add fgColor, bgColor and title to Verdict object

  ## how

  ## why
  - this will be used in api endpoint `/api/poll/pollId`
    - it will be used for filling in the necessary data needed for the
      front end

  ## where
  - ./src/types/index.ts

  ## usage
  ## what
  - update setting `verdict` properties

  ## how

  ## why
  - to work with the change in commit 98090f4

  ## where
  - ./src/app/api/poll/[pollId]/route.ts

  ## usage
  ## what
  - add types to `Verdict` and `Language`

  ## how

  ## why
  - to be able to dynamically use the object using `[]` notation
    - typescript complains about object index type compatibility issues

  ## where
  - ./src/types/index.ts

  ## usage
  ## what
  - reword the variables being used

  ## how

  ## why
  - code is more readable

  ## where
  - ./src/app/api/poll/[pollId]/route.ts

  ## usage
  ## what
  - add component `LiveSubmissionTable`

  ## how

  ## why
  - will be used for displaying live submissions

  ## where
  - ./src/app/LiveSubmissionTable.tsx

  ## usage
  ## what
  - add docs to `VerdictType`

  ## how

  ## why

  ## where
  - ./src/types/index.ts

  ## usage
Clumsy-Coder and others added 25 commits January 15, 2024 07:57
…t chart

  ## what
  - display problem solved VS user submissions with donut chart

  ## how
  - fetch the data using react-query hook `useFetchUserSubmissionAttempted`
  - display the data using Rechart donut chart

  ## why
  - to display user solved problems VS user submissions

  ## where
  - ./src/app/users/[username]/page.tsx

  ## usage
  ## what
  - add style to display tooltip color

  ## how
  - use `style` property
    - use `backgroundColor`

  ## why
  - sometimes the background color is not applied when using tailwindcss
  - this method will make sure to apply the background color

  ## where
  - ./src/components/charts/Tooltip.tsx

  ## usage
  ## what
  - add `Loading` component for `/users/[username]` page

  ## how

  ## why
  - this will be displayed when fetching data on the `/users/[username]`
    page

  ## where
  - ./src/app/users/[username]/loading.tsx

  ## usage
…/users/[username]` page

  ## what
  - display `Loading` component when fetching data on `/users/[username]` page

  ## how

  ## why

  ## where
  - ./src/app/users/[username]/page.tsx

  ## usage
  ## what
  - replace `isLoading` with `isFetching` from react-query hooks

  ## how

  ## why
  - scenario
    - currently in user page
    - navigate to `/` page
    - click on a user link
    - loading component is not being displayed
  - `isFetching` will be true when fetching data even if the page has
    been mounted

  ## where
  - ./src/app/users/[username]/page.tsx

  ## usage
  ## what
  - format code

  ## how

  ## why

  ## where
  - ./src/app/users/[username]/page.tsx

  ## usage
  ## what
  - add screenshot of `/users/[username]` page
    - loading
    - data loaded

  ## how

  ## why

  ## where
  - ./docs/images/page-users-username-loading.png
  - ./docs/images/page-users-username.png

  ## usage
  ## what
  - display screenshots for `/users/[username]` page

  ## how

  ## why

  ## where
  - ./README.md

  ## usage
## [1.0.0-development.6](1.0.0-development.5...1.0.0-development.6) (2024-1-15)

### ✨ Features

* **api:user:submissions:verdict:** add endpoint `/api/users/[username]/submissions/verdict` ([33101e6](33101e6))
* **api:user:submissions:** add endpoint `/api/users/[username]/submissions` ([023d886](023d886))
* **api:users:attempted:** add endpoint `/api/users/[username]/submissions/attempted` ([f3ea62c](f3ea62c))
* **api:users:submissions:** add endpoint `/api/users/[username]/submissions/language` ([d773671](d773671))
* **api:users:submissions:** add endpoint `/api/users/[username]/submissions/overtime` ([01232a7](01232a7))
* **components:charts:** add `SolvedVsAttemptedDonutChart` component ([25bda0e](25bda0e))
* **page:user:** display problem solved VS user submissions with donut chart ([e2689d5](e2689d5))
* **page:user:** display user submissions by language with radar chart ([54639ab](54639ab))
* **page:user:** display user submissions by verdict with bar chart ([2d8a058](2d8a058))
* **page:user:** display user submissions on `/users/[username]` page ([c937b78](c937b78))
* **page:user:** display user submissions overtime with area chart ([21ea5f1](21ea5f1))
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.2.47 to 18.2.48.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

---
updated-dependencies:
- dependency-name: "@types/react"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [recharts](https://github.com/recharts/recharts) from 2.10.3 to 2.10.4.
- [Release notes](https://github.com/recharts/recharts/releases)
- [Changelog](https://github.com/recharts/recharts/blob/master/CHANGELOG.md)
- [Commits](recharts/recharts@v2.10.3...v2.10.4)

---
updated-dependencies:
- dependency-name: recharts
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [@tanstack/react-query-devtools](https://github.com/TanStack/query/tree/HEAD/packages/react-query-devtools) from 5.17.9 to 5.17.12.
- [Release notes](https://github.com/TanStack/query/releases)
- [Commits](https://github.com/TanStack/query/commits/v5.17.12/packages/react-query-devtools)

---
updated-dependencies:
- dependency-name: "@tanstack/react-query-devtools"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.0 to 20.11.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
  ## what
  - disable refetch on mount for `all problems`

  ## how

  ## why

  ## where
  - ./src/hooks/index.ts

  ## usage
  ## what
  - add type for search results
    - title: string to show in search results
    - href: link path for the search result

  ## how

  ## why
  - this will be used for defining a data structure for search results
    from the api
  - this will be used by api endpoint `/api/search/[searchStr]`

  ## where
  - ./src/types/index.ts

  ## usage
  ## what
  - add schema for endpoint `/api/search/[searchStr]`

  ## how

  ## why
  - this will be used to validate the data on client side and server
    side

  ## where
  - ./src/schema/index.ts

  ## usage
  ## what
  - add endpoint `/api/search/[searchStr]`

  ## how
  - check if the `searchStr` is valid (using zod schema)
    - must be a string length of 1
  - if `searchStr` is not valid, return 400
  - if username exists, add SearchResult to an array
    - title: `User: [username]`
    - href: `/users/[username]`
  - if problem number exists, add SearchResult to an array
    - title: `Problem: [problem number] [problem title]`
    - href: `/problems/[problem number]`
  - return response using the SearchResult array

  ## why
  - this endpoint will be used to search for a problem number or a
    username

  ## where
  - ./src/app/api/search/[searchStr]/route.ts

  ## usage
  ## problem
  - user submissions overtime chart doesn't render correctly if the user
    has only one year of submissions

  ## solution
  - check if the submissions contain the current year
    - if it doesn't add an entry in the object
      - `[current year]: 0`

  ## why
  - this will fix the issue if there was one year in the user
    submissions
    - ex:
      - user submissions only has year 2015
      - checks if current year is included in the submissions,
        - adds current year
      - fill in the years missing
      - chart renders correctly

  ## where
  - ./src/app/api/users/[username]/submissions/overtime/route.ts

  ## usage
  ## what
  - add react-query hook for searching users or problems

  ## how
  - fetch from api endpoint `/api/search/[searchStr]`

  ## why

  ## where
  - ./src/hooks/index.ts

  ## usage
  ## what
  - add `searchbar` component

  ## how
  - use react `useState` to keep track of search string
    - also using useState because the component will rerender when the
      state value changes, causing react-query hook to send request to
      api
    - use react-query hook `useFetchSearch` to send a GET request to api
      for searching username or problem number
    - use a form to render the search input
    - use a div to display the search results
    - if there's search results, display a link

  ## why

  ## where
  - ./src/components/searchbar.tsx

  ## usage
  ## what
  - display `searchbar` component

  ## how

  ## why

  ## where
  - ./src/components/navbar.tsx

  ## usage
  ## what
  - add screenshot of `navbar` component

  ## how

  ## why

  ## where
  - ./docs/images/navbar.png

  ## usage
  ## what
  - display screenshot for `navbar` component

  ## how

  ## why

  ## where
  - ./README.md

  ## usage
## [1.0.0-development.7](1.0.0-development.6...1.0.0-development.7) (2024-1-16)

### ✨ Features

* **api:search:** add endpoint `/api/search/[searchStr]` ([bf15e83](bf15e83))
* **components:search:** add `searchbar` component ([d8acdd9](d8acdd9))

### 🐛 Bug Fixes

* **api:users:submissions:overtime:** submission with one year ([8b69ffa](8b69ffa))
  ## what
  - add resource links

  ## how

  ## why

  ## where
  - ./README.md

  ## usage
@Clumsy-Coder Clumsy-Coder self-assigned this Jan 16, 2024
Copy link

vercel bot commented Jan 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
uva-uhunt ✅ Ready (Inspect) Visit Preview Jan 16, 2024 1:10am

@Clumsy-Coder Clumsy-Coder merged commit 8d404f0 into master Jan 16, 2024
8 checks passed
@Clumsy-Coder
Copy link
Owner Author

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants