Skip to content

Commit

Permalink
feat #2 : add contribution support (#23)
Browse files Browse the repository at this point in the history
* fix: make image larger to avoid wrap

* fix: remove useless `as unknown`

* feat #2 : started implementation of contribute page

* feat #2 : add contribution deletion

* feat #2 : move draft modal into its own component

* feat #2 : make sure contribution file is also deleted

* feat #2 : finish basic modal setup for draft contributions

* fix : modal offset

* fix : make sure cursor is a pointer on clickable components

* feat #2 : almost finished contribute page

* feat #2 : add poll counts to accepted submissions

* feat #2 : fix deleted submissions still being displayed

* feat #2 : "CSS" fixes

* packages : update prisma

* feat #2 : add COUNCIL role

* feat #2 : better use for the accordion

* feat #2 : add council page & contribution counselor vote

* fix: better name for many-to-many relations tables

* feat #2: add co-submitted accordion to submitted page

* fix: add new ESLint rules

* fix: SCSS linting

* feat #2 : add loading state when auto selecting a texture

* feat #2 : correctly update contribute page on change

* feat #2: rename comp directory from submit to contribute

* fix : add ESLint plugin to remove unused imports

* tools : add more configs to .editorconfig
  • Loading branch information
Juknum authored Apr 7, 2024
1 parent 49a0d9c commit 5902c2a
Show file tree
Hide file tree
Showing 61 changed files with 2,023 additions and 219 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[*]
charset = utf-8
end_of_line = lf
tab_width = 2
indent_style = tab
quote_type = single
insert_final_newline = true
trim_trailing_whitespace = true

[*.yml]
tab_width = 2
Expand Down
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"extends": "next/core-web-vitals",
"plugins": ["unused-imports"],
"rules": {
"indent": ["error", "tab"],
"quotes": ["error", "single"],
"semi": ["error", "always"],
"comma-dangle": ["error", "always-multiline"],
"unused-imports/no-unused-imports": "error",
"import/order": [
"error",
{
Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"editorconfig.editorconfig"
]
}
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"cSpell.words": [
"dependants",
"downvoted",
"Downvoted",
"downvotes",
"dropzone",
"hookform",
"mantine",
Expand All @@ -11,7 +14,12 @@
"prisma",
"stylelint",
"tailwindcss",
"unzipper"
"unvoted",
"Unvoted",
"unzipper",
"upvoted",
"Upvoted",
"upvotes"
],
"files.exclude": {
"**/.git": true,
Expand Down
103 changes: 67 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint --fix",
"lint": "next lint --fix; npx stylelint \"src/**/*.{scss,css}\" --fix",
"postinstall": "prisma generate"
},
"dependencies": {
Expand All @@ -22,7 +22,6 @@
"@mantine/hooks": "^7.5.3",
"@mantine/modals": "^7.5.3",
"@mantine/notifications": "^7.5.3",
"@prisma/client": "^5.10.2",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
Expand Down Expand Up @@ -56,6 +55,7 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@prisma/client": "^5.12.1",
"@types/bcrypt": "^5.0.2",
"@types/bcryptjs": "^2.4.6",
"@types/multer": "^1.4.11",
Expand All @@ -67,10 +67,11 @@
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.4",
"eslint-plugin-unused-imports": "^3.1.0",
"postcss": "^8.4.35",
"postcss-preset-mantine": "^1.13.0",
"postcss-simple-vars": "^7.0.1",
"prisma": "^5.10.2",
"prisma": "^5.12.1",
"stylelint": "^15.11.0",
"stylelint-config-standard-scss": "^8.0.0",
"stylelint-scss": "^4.7.0",
Expand Down
53 changes: 31 additions & 22 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ generator client {

enum UserRole {
ADMIN
COUNCIL
USER
BANNED
}
Expand All @@ -20,6 +21,7 @@ enum Resolution {
}

enum Status {
DRAFT
PENDING
ACCEPTED
REJECTED
Expand Down Expand Up @@ -67,7 +69,7 @@ model ModpackVersion {
version String
modpack Modpack @relation(fields: [modpackId], references: [id])
modpackId String @map("modpack_id")
mods ModVersion[]
mods ModVersion[] @relation("mods_versions_to_modpacks_versions")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
Expand Down Expand Up @@ -99,7 +101,7 @@ model ModVersion {
modId String @map("mod_id")
resources Resource[]
ModpackVersion ModpackVersion[]
ModpackVersion ModpackVersion[] @relation("mods_versions_to_modpacks_versions")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
Expand Down Expand Up @@ -183,14 +185,19 @@ model LinkedTexture {
// }

model Contribution {
id String @id @default(cuid())
file String
date DateTime @default(now())
users User[]
id String @id @default(cuid())
file String
filename String
date DateTime @default(now())
ownerId String
owner User @relation(fields: [ownerId], references: [id])
coAuthors User[] @relation("contributions_to_coauthors")
resolution Resolution
status Status
status Status @default(DRAFT)
pollId String
pollId String @unique
poll Poll @relation(fields: [pollId], references: [id])
Texture Texture? @relation(fields: [textureId], references: [id])
Expand All @@ -205,36 +212,38 @@ model Contribution {
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("users_contributions")
@@map("contributions")
}

model User {
id String @id @default(cuid())
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime? @map("email_verified")
email String? @unique
emailVerified DateTime? @map("email_verified")
image String?
role UserRole @default(USER)
role UserRole @default(USER)
accounts Account[]
contributions Contribution[]
contributions Contribution[]
coContributions Contribution[] @relation("contributions_to_coauthors")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
pollsUpvoted Poll[] @relation("Upvotes")
pollsDownvoted Poll[] @relation("Downvotes")
pollsUpvoted Poll[] @relation("polls_upvotes_to_users")
pollsDownvoted Poll[] @relation("polls_downvotes_to_users")
@@map("users")
}

model Poll {
id String @id @default(cuid())
upvotes User[] @relation("Upvotes")
downvotes User[] @relation("Downvotes")
upvotes User[] @relation("polls_upvotes_to_users")
downvotes User[] @relation("polls_downvotes_to_users")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
Contribution Contribution[]
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
Contribution Contribution?
@@map("users_polls")
@@map("polls")
}
Loading

0 comments on commit 5902c2a

Please sign in to comment.