Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat #2 : add contribution support #23

Merged
merged 26 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9599505
fix: make image larger to avoid wrap
Juknum Apr 2, 2024
5927789
fix: remove useless `as unknown`
Juknum Apr 2, 2024
9e7068d
feat #2 : started implementation of contribute page
Juknum Apr 2, 2024
71a6049
feat #2 : add contribution deletion
Juknum Apr 3, 2024
24f98c6
feat #2 : move draft modal into its own component
Juknum Apr 3, 2024
49a9546
feat #2 : make sure contribution file is also deleted
Juknum Apr 3, 2024
cfae710
feat #2 : finish basic modal setup for draft contributions
Juknum Apr 4, 2024
c76ab8e
fix : modal offset
Juknum Apr 7, 2024
f6ed183
fix : make sure cursor is a pointer on clickable components
Juknum Apr 7, 2024
82ac1da
feat #2 : almost finished contribute page
Juknum Apr 7, 2024
2330dc1
feat #2 : add poll counts to accepted submissions
Juknum Apr 7, 2024
579f479
feat #2 : fix deleted submissions still being displayed
Juknum Apr 7, 2024
15f7ad9
feat #2 : "CSS" fixes
Juknum Apr 7, 2024
11e68d9
packages : update prisma
Juknum Apr 7, 2024
78a6a86
feat #2 : add COUNCIL role
Juknum Apr 7, 2024
f5a5c1c
feat #2 : better use for the accordion
Juknum Apr 7, 2024
d43f26c
feat #2 : add council page & contribution counselor vote
Juknum Apr 7, 2024
b276deb
fix: better name for many-to-many relations tables
Juknum Apr 7, 2024
8e49d7a
feat #2: add co-submitted accordion to submitted page
Juknum Apr 7, 2024
21a7151
fix: add new ESLint rules
Juknum Apr 7, 2024
f8ead00
fix: SCSS linting
Juknum Apr 7, 2024
eecdf39
feat #2 : add loading state when auto selecting a texture
Juknum Apr 7, 2024
64c7dd0
feat #2 : correctly update contribute page on change
Juknum Apr 7, 2024
d9efee6
feat #2: rename comp directory from submit to contribute
Juknum Apr 7, 2024
0abbb79
fix : add ESLint plugin to remove unused imports
Juknum Apr 7, 2024
7d4a0e2
tools : add more configs to .editorconfig
Juknum Apr 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading