Skip to content

Commit

Permalink
Merge branch 'staging' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado-x authored Aug 12, 2024
2 parents 61b0850 + 15b23f3 commit 56f59e2
Show file tree
Hide file tree
Showing 122 changed files with 1,904 additions and 887 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
tag1="kpiua/schedule.kpi.ua:$now"
tag2="kpiua/schedule.kpi.ua:latest"
docker build ./ --file ./.dockerfile --tag $tag1 --tag $tag2
docker build ./ --file ./Dockerfile --tag $tag1 --tag $tag2
docker push $tag1
docker push $tag2
4 changes: 2 additions & 2 deletions .dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM node:lts-alpine as builder
RUN apk add --no-cache python3 py3-pip make g++
# set working directory
WORKDIR /app
WORKDIR /

COPY package*.json ./

Expand All @@ -15,7 +15,7 @@ RUN npm run build

# production
FROM nginx:stable-alpine
COPY --from=builder /app/build /usr/share/nginx/html
COPY --from=builder /build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ npm run build

### Build Docker container
```
docker build ./ --file ./.dockerfile --tag kpiua/schedule.kpi.ua:latest
docker build ./ --file ./Dockerfile --tag kpiua/schedule.kpi.ua:latest
```

### Run latest Docker container
Expand Down
1,082 changes: 941 additions & 141 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^14.4.3",
"@types/material-ui": "^0.21.17",
"@types/node": "^20.14.2",
"@types/react": "^17.0.80",
"@types/react-dom": "^18.3.0",
"@types/styled-components": "^5.1.34",
"@types/styled-system": "^5.1.22",
"axios": "^0.27.2",
"clsx": "^1.2.0",
"moment": "^2.29.4",
"node-sass": "^7.0.3",
"react": "17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "^5.0.1",
"react-select": "^5.4.0",
"react-select-virtualized": "5.2.0",
"react-virtualized": "^9.22.3",
"sass": "^1.77.5",
"styled-components": "^5.3.5",
"styled-system": "^5.1.5",
"web-vitals": "^3.0.2"
Expand Down Expand Up @@ -48,6 +54,8 @@
]
},
"devDependencies": {
"gh-pages": "^4.0.0"
"@types/react-router-dom": "^5.3.3",
"gh-pages": "^4.0.0",
"typescript": "^4.9.5"
}
}
2 changes: 2 additions & 0 deletions src/@types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module 'react-select-virtualized';
declare module '*.svg';
2 changes: 1 addition & 1 deletion src/api/fullList.js → src/api/fullList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const getAllLecturers = () => {
export const getAllGroups = () => {
return Http.get("/schedule/groups").then(({ data }) => {
return {
data: data.data.map((row) => ({
data: data.data.map((row: {name: string, faculty: string, id: string}) => ({
name: `${row.name.trim()} (${row.faculty.trim()})`,
id: row.id,
})),
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/api/schedule.js → src/api/schedule.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import Http from './index';

export const getScheduleByLecturer = lecturerId => {
export const getScheduleByLecturer = (lecturerId: string) => {
return Http.get('/schedule/lecturer?lecturerId=' + lecturerId)
.then(res => res.data);
}

export const getScheduleByGroup = groupId => {
export const getScheduleByGroup = (groupId: string) => {
return Http.get('/schedule/lessons?groupId=' + groupId)
.then(res => res.data);
}

export const getExamsByGroup = groupName => {
export const getExamsByGroup = (groupName: string) => {
return Http.get('/exams/group?groupId=' + groupName)
.then(res => res.data);
}
34 changes: 0 additions & 34 deletions src/app/App.js

This file was deleted.

36 changes: 36 additions & 0 deletions src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { GroupContextProvider } from "../common/context/groupContext";
import { LecturerContextProvider } from "../common/context/lecturerContext";
import { PreloadedListsContextProvider } from "../common/context/preloadedListsContext";
import { WeekContextProvider } from "../common/context/weekContext";
import { useCurrentDateParams } from "../common/utils/useCurrentDateParams";
import ThemeContextProvider from "../common/context/themeContext";
import Navbar from "../containers/navbar";
import ScheduleRouter from "../containers/router";
import ScrollToTop from "../containers/scrollToTop/index";
import { Wrapper } from "./app.style";

function App() {
const { currentWeek } = useCurrentDateParams();
return (
<WeekContextProvider
initialValue={currentWeek === 1 ? "firstWeek" : "secondWeek"}
>
<PreloadedListsContextProvider>
<GroupContextProvider>
<ThemeContextProvider>
<LecturerContextProvider>
<ScrollToTop>
<Wrapper>
<Navbar />
<ScheduleRouter />
</Wrapper>
</ScrollToTop>
</LecturerContextProvider>
</ThemeContextProvider>
</GroupContextProvider>
</PreloadedListsContextProvider>
</WeekContextProvider>
);
}

export default App;
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MODES } from '../../common/constants/modes';
import { MODES } from './modes';

export const DAY_OPTIONS = {
[MODES.EXTRA_SMALL]: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export const MODES = {
SMALL: 'smallMode',
MEDIUM: 'mediumMode',
BIG: 'bigMode',
};
} as Record<string, string>;
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export const getSelectCustomStyle = (theme) => ({
option(base) {
export const getSelectCustomStyle = (theme: any) => ({
option(base: any) {
return {
...base,
color: theme['primaryFontColor'],
};
},
menu(base) {
menu(base: any) {
return {
...base,
"& .fast-option-focused": {
Expand All @@ -20,34 +20,34 @@ export const getSelectCustomStyle = (theme) => ({
zIndex: 1000,
};
},
menuList(base) {
menuList(base: any) {
return {
...base,
backgroundColor: theme['bgOptions'],
zIndex: 1000,
};
},
control(base) {
control(base: any) {
return {
...base,
backgroundColor: theme['bgOptions'],
color: theme['primaryFontColor'],
border: 'none',
};
},
indicatorSeparator(base) {
indicatorSeparator(base: any) {
return {
...base,
display: 'none'
};
},
singleValue(base) {
singleValue(base: any) {
return {
...base,
color: theme['primaryFontColor'],
};
},
input(base) {
input(base: any) {
return {
...base,
color: theme['primaryFontColor'],
Expand Down
16 changes: 0 additions & 16 deletions src/common/constants/subjectTypes.js

This file was deleted.

22 changes: 22 additions & 0 deletions src/common/constants/subjectTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { AnyStyledComponent } from "styled-components";
import {
ScheduleItemTypeLab,
ScheduleItemTypeLec,
ScheduleItemTypePrac,
} from "../../components/scheduleItemContent/scheduleItemContent.style";

export const SUBJECT_TYPES: Record<string, { component: AnyStyledComponent; title: string }> =
{
lec: {
component: ScheduleItemTypeLec,
title: "Лек",
},
lab: {
component: ScheduleItemTypeLab,
title: "Лаб",
},
prac: {
component: ScheduleItemTypePrac,
title: "Прак",
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ export const theme = {
currentDayContainer: 'linear-gradient(180deg, rgba(54, 54, 55, 0) 0%, rgba(54, 54, 55, 0.5) 10.73%, #363637 55%, rgba(54, 54, 55, 0.5) 89.9%, rgba(54, 54, 55, 0.29) 100%)',
svgPrimaryFilter: 'invert(100%) sepia(0%) saturate(0%) hue-rotate(46deg) brightness(100%) contrast(103%)',
}
};
} as any;
15 changes: 0 additions & 15 deletions src/common/context/groupContext.js

This file was deleted.

27 changes: 27 additions & 0 deletions src/common/context/groupContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, { createContext, useContext, useState } from "react";

interface Props {
children: React.ReactNode
}

interface GroupContextType {
group?: any;
setGroup: React.Dispatch<any>;
};


const defaultContext: GroupContextType = {
setGroup: () => {},
};

const GroupContext = createContext<GroupContextType>(defaultContext);

export const useGroupContext = () => useContext(GroupContext);

export const GroupContextProvider: React.FC<Props> = ({ children }) => {
const [group, setGroup] = useState<any>();

const params: GroupContextType = { setGroup, group };

return <GroupContext.Provider value={params}>{children}</GroupContext.Provider> ;
};
17 changes: 0 additions & 17 deletions src/common/context/lecturerContext.js

This file was deleted.

32 changes: 32 additions & 0 deletions src/common/context/lecturerContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { createContext, useContext, useState, ReactNode, FC } from 'react';

interface Props {
children: ReactNode;
}

interface LecturerContextType {
lecturer: string | null; // Change this to the actual type of lecturer
setLecturer: React.Dispatch<React.SetStateAction<string | null>>;
}

const LecturerContext = createContext<LecturerContextType | null>(null);

export const useLecturerContext = () => {
const context = useContext(LecturerContext);
if (context === null) {
throw new Error('useLecturerContext must be used within a LecturerContextProvider');
}
return context;
};

export const LecturerContextProvider: FC<Props> = ({ children }) => {
const [lecturer, setLecturer] = useState<string | null>(null);

const params = { lecturer, setLecturer };

return (
<LecturerContext.Provider value={params}>
{children}
</LecturerContext.Provider>
);
};
Loading

0 comments on commit 56f59e2

Please sign in to comment.