Skip to content

Commit

Permalink
Made frontend build again
Browse files Browse the repository at this point in the history
  • Loading branch information
ViddeM committed May 23, 2024
1 parent befdf47 commit 3fb16c2
Show file tree
Hide file tree
Showing 37 changed files with 752 additions and 706 deletions.
3 changes: 3 additions & 0 deletions frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
File renamed without changes.
6 changes: 3 additions & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine as DEPS
FROM node:20-alpine as DEPS

WORKDIR /app
COPY package.json yarn.lock ./
Expand All @@ -14,7 +14,7 @@ RUN yarn install --frozen-lockfile



FROM node:16-alpine as BUILD_IMAGE
FROM node:20-alpine as BUILD_IMAGE

WORKDIR /app

Expand All @@ -27,7 +27,7 @@ RUN yarn install --production --frozen-lockfile --ignore-scripts --prefer-offlin



FROM node:16-alpine
FROM node:20-alpine

ENV NODE_ENV production

Expand Down
2 changes: 1 addition & 1 deletion frontend/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const nextConfig = {
return [
{
source: '/api/:ep*',
destination: `${process.env.BACKEND_ADDRESS}/api/:ep*`,
destination: `${process.env.BACKEND_ADDRESS ?? ''}/api/:ep*`,
},
];
},
Expand Down
14 changes: 8 additions & 6 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
"clean": "rimraf .next **/__generated__",
"dev": "yarn generate-gql-types && next dev",
"generate-gql-types": "graphql-codegen",
"lint:check": "yarn generate-gql-types && eslint --ignore-path .gitignore --ext .ts,.tsx . && yarn prettier:check",
"lint:fix": "yarn generate-gql-types && eslint --ignore-path .gitignore --ext .ts,.tsx --fix . && yarn prettier:fix",
"prettier:check": "yarn generate-gql-types && prettier --list-different --ignore-path .gitignore \"**/*.{ts,tsx,js,jsx,json,yml,yaml}\"",
"prettier:fix": "yarn generate-gql-types && prettier --write --loglevel error --ignore-path .gitignore \"**/*.{ts,tsx,js,jsx,json,yml,yaml}\"",
"lint": "yarn generate-gql-types && next lint",
"lint:check": "yarn generate-gql-types && eslint --ignore-pattern .gitignore -c .ts,.tsx . && yarn prettier:check",
"lint:fix": "yarn generate-gql-types && eslint --ignore-pattern .gitignore -c .ts,.tsx --fix . && yarn prettier:fix",
"prettier:check": "yarn generate-gql-types && prettier --list-different --ignore-pattern .gitignore \"**/*.{ts,tsx,js,jsx,json,yml,yaml}\"",
"prettier:fix": "yarn generate-gql-types && prettier --write --loglevel error --ignore-pattern .gitignore \"**/*.{ts,tsx,js,jsx,json,yml,yaml}\"",
"generate-gql-schema": "cd ../backend && cargo run --bin export_sdl > ../frontend/schema.gql",
"start": "node server.js",
"test": "yarn generate-gql-types && jest -c ./.jestrc.json \".*\\.test\\.(ts|js)\" --passWithNoTests"
Expand All @@ -32,6 +33,7 @@
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-regular-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@next/eslint-plugin-next": "^14.2.3",
"dateformat": "^5.0.3",
"graphql": "^16.8.1",
"graphql-tag": "^2.12.6",
Expand All @@ -55,8 +57,8 @@
"@types/react": "^18.2.71",
"@types/react-dom": "^18.2.22",
"@types/recharts": "^1.8.29",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"eslint": "^8.57.0",
"eslint-config-next": "14.1.4",
"eslint-config-prettier": "^9.1.0",
Expand Down
184 changes: 89 additions & 95 deletions frontend/schema.gql
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
type ActiveSession {
user: User!
startTime: DateTime!
user: User!
startTime: DateTime!
}


"""
Implement the DateTime<Utc> scalar
Expand All @@ -12,126 +11,122 @@ The input/output is a string in RFC3339 format.
scalar DateTime

type Device {
id: UUID!
address: String!
name: String!
isActive: Boolean!
id: UUID!
address: String!
name: String!
isActive: Boolean!
}

input DeviceInput {
address: String!
name: String!
address: String!
name: String!
}


type Group {
name: String!
prettyName: String!
name: String!
prettyName: String!
}



type MutationRoot {
setDevices(data: SetDevicesInput!): [Device!]!
setDevices(data: SetDevicesInput!): [Device!]!
}

enum Period {
SUMMER
LP1
LP2
LP3
LP4
SUMMER
LP1
LP2
LP3
LP4
}

type QueryRoot {
currentSessions: [ActiveSession!]!
statsAlltime: [Stat!]!
statsStudyYear(input: StatsStudyYearInput): StatsStudyYearPayload!
statsStudyPeriod(input: StatsStudyPeriodInput): StatsStudyPeriodPayload!
statsMonth(input: StatsMonthInput): StatsMonthPayload!
statsWeek(input: StatsWeekInput): StatsWeekPayload!
statsDay(input: StatsDayInput): StatsDayPayload!
me: User!
user(input: UserUniqueInput!): User!
currentSessions: [ActiveSession!]!
statsAlltime: [Stat!]!
statsStudyYear(input: StatsStudyYearInput): StatsStudyYearPayload!
statsStudyPeriod(input: StatsStudyPeriodInput): StatsStudyPeriodPayload!
statsMonth(input: StatsMonthInput): StatsMonthPayload!
statsWeek(input: StatsWeekInput): StatsWeekPayload!
statsDay(input: StatsDayInput): StatsDayPayload!
me: User!
user(input: UserUniqueInput!): User!
}

type Session {
startTime: DateTime!
endTime: DateTime!
startTime: DateTime!
endTime: DateTime!
}

input SetDevicesInput {
devices: [DeviceInput!]!
devices: [DeviceInput!]!
}

type Stat {
user: User!
durationSeconds: Int!
currentPosition: Int!
prevPosition: Int
user: User!
durationSeconds: Int!
currentPosition: Int!
prevPosition: Int
}

input StatsDayInput {
year: Int!
month: Int!
day: Int!
year: Int!
month: Int!
day: Int!
}

type StatsDayPayload {
stats: [Stat!]!
curr: YearMonthDay!
next: YearMonthDay!
prev: YearMonthDay!
stats: [Stat!]!
curr: YearMonthDay!
next: YearMonthDay!
prev: YearMonthDay!
}

input StatsMonthInput {
year: Int!
month: Int!
year: Int!
month: Int!
}

type StatsMonthPayload {
stats: [Stat!]!
curr: YearMonth!
next: YearMonth!
prev: YearMonth!
stats: [Stat!]!
curr: YearMonth!
next: YearMonth!
prev: YearMonth!
}

input StatsStudyPeriodInput {
year: Int!
period: Period!
year: Int!
period: Period!
}

type StatsStudyPeriodPayload {
stats: [Stat!]!
year: Int!
period: Period!
stats: [Stat!]!
year: Int!
period: Period!
}

input StatsStudyYearInput {
year: Int!
year: Int!
}

type StatsStudyYearPayload {
stats: [Stat!]!
year: Int!
stats: [Stat!]!
year: Int!
}

input StatsWeekInput {
year: Int!
week: Int!
year: Int!
week: Int!
}

type StatsWeekPayload {
stats: [Stat!]!
curr: YearWeek!
next: YearWeek!
prev: YearWeek!
stats: [Stat!]!
curr: YearWeek!
next: YearWeek!
prev: YearWeek!
}


type SubscriptionRoot {
userJoin: ActiveSession!
userLeave: User!
userJoin: ActiveSession!
userLeave: User!
}

"""
Expand All @@ -147,48 +142,47 @@ entities without requiring a central allocating authority.
scalar UUID

type User {
id: UUID!
cid: String!
nick: String!
firstName: String!
lastName: String!
avatarUrl: String!
groups: [Group!]!
hourStats: [Int!]!
recentSessions: [Session!]!
longestSession: Session
totalTimeSeconds: Int!
averageTimePerDay: Int!
timeTodaySeconds: Int!
devices: [Device!]!
currAlltimePosition: Int
currStudyYearPosition: Int
id: UUID!
cid: String!
nick: String!
firstName: String!
lastName: String!
avatarUrl: String!
groups: [Group!]!
hourStats: [Int!]!
recentSessions: [Session!]!
longestSession: Session
totalTimeSeconds: Int!
averageTimePerDay: Int!
timeTodaySeconds: Int!
devices: [Device!]!
currAlltimePosition: Int
currStudyYearPosition: Int
}

input UserUniqueInput {
id: UUID
cid: String
id: UUID
cid: String
}

type YearMonth {
year: Int!
month: Int!
year: Int!
month: Int!
}

type YearMonthDay {
year: Int!
month: Int!
day: Int!
year: Int!
month: Int!
day: Int!
}

type YearWeek {
year: Int!
week: Int!
year: Int!
week: Int!
}

schema {
query: QueryRoot
mutation: MutationRoot
subscription: SubscriptionRoot
query: QueryRoot
mutation: MutationRoot
subscription: SubscriptionRoot
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
padding: 4em 0;
width: 45%;


@media (max-width: 810px) {
width: 100%;
}
Expand All @@ -25,4 +24,4 @@

.activeGroupsContainer th {
text-align: center;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ tr .statusRow {
td.timeCell {
text-align: right;
}

9 changes: 6 additions & 3 deletions frontend/src/components/device-list/DeviceList.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
border-radius: 5px;
cursor: pointer;

box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 2px 1px -2px rgba(0, 0, 0, 0.1), 0 1px 5px 0 rgba(0, 0, 0, 0.1);
box-shadow:
0 2px 2px 0 rgba(0, 0, 0, 0.1),
0 2px 1px -2px rgba(0, 0, 0, 0.1),
0 1px 5px 0 rgba(0, 0, 0, 0.1);

&:hover {
background-color: rgba(0, 0, 0, 0.05);
Expand Down Expand Up @@ -82,8 +85,8 @@
}

.horizontalScrollArea {
@media(max-width: 700px) {
@media (max-width: 700px) {
width: 100%;
overflow-x: scroll;
}
}
}
Loading

0 comments on commit 3fb16c2

Please sign in to comment.