Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
67 changes: 58 additions & 9 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,60 @@
"projectType": "application",
"architect": {
"build": {
"builder": "@nrwl/node:build",
"builder": "@nrwl/web:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/apps/admin-panel",
"index": "apps/admin-panel/src/index.html",
"baseHref": "/",
"main": "apps/admin-panel/src/main.js",
"polyfills": "apps/admin-panel/src/polyfills.js",
"tsConfig": "apps/admin-panel/tsconfig.app.json",
"assets": ["apps/admin-panel/src/assets"]
"assets": [
"apps/admin-panel/src/favicon.ico",
"apps/admin-panel/src/assets"
],
"styles": ["apps/admin-panel/src/styles.css"],
"scripts": [],
"webpackConfig": "@nrwl/react/plugins/webpack"
},
"configurations": {
"production": {
"optimization": true,
"extractLicenses": true,
"inspect": false,
"fileReplacements": [
{
"replace": "apps/admin-panel/src/environments/environment.js",
"with": "apps/admin-panel/src/environments/environment.prod.js"
}
]
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false
}
}
},
"serve": {
"builder": "@nrwl/node:execute",
"builder": "@nrwl/web:dev-server",
"options": {
"buildTarget": "admin-panel:build"
"buildTarget": "admin-panel:build",
"hmr": true,
"port": 4300
},
"configurations": {
"production": {
"buildTarget": "admin-panel:build:production",
"hmr": false
}
}
},
"lint": {
"builder": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/admin-panel/**/*.js"]
"lintFilePatterns": ["apps/admin-panel/**/*.{ts,tsx,js,jsx}"]
}
},
"test": {
Expand All @@ -53,6 +74,34 @@
},
"tags": []
},
"admin-panel-e2e": {
"root": "apps/admin-panel-e2e",
"sourceRoot": "apps/admin-panel-e2e/src",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/admin-panel-e2e/cypress.json",
"devServerTarget": "admin-panel:serve"
},
"configurations": {
"production": {
"devServerTarget": "admin-panel:serve:production"
}
}
},
"lint": {
"builder": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/admin-panel-e2e/**/*.js"]
}
}
},
"tags": [],
"implicitDependencies": ["admin-panel"]
},
"e-learning-app": {
"root": "apps/e-learning-app",
"sourceRoot": "apps/e-learning-app/src",
Expand Down
10 changes: 10 additions & 0 deletions apps/admin-panel-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}
12 changes: 12 additions & 0 deletions apps/admin-panel-e2e/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"fileServerFolder": ".",
"fixturesFolder": "./src/fixtures",
"integrationFolder": "./src/integration",
"modifyObstructiveCode": false,
"supportFile": "./src/support/index.js",
"pluginsFile": false,
"video": true,
"videosFolder": "../../dist/cypress/apps/admin-panel-e2e/videos",
"screenshotsFolder": "../../dist/cypress/apps/admin-panel-e2e/screenshots",
"chromeWebSecurity": false
}
4 changes: 4 additions & 0 deletions apps/admin-panel-e2e/src/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}
10 changes: 10 additions & 0 deletions apps/admin-panel-e2e/src/integration/app.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { getGreeting } from '../support/app.po';
describe('admin-panel', () => {
beforeEach(() => cy.visit('/'));
it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('my-email@something.com', 'myPassword');
// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome to admin-panel!');
});
});
1 change: 1 addition & 0 deletions apps/admin-panel-e2e/src/support/app.po.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
25 changes: 25 additions & 0 deletions apps/admin-panel-e2e/src/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
16 changes: 16 additions & 0 deletions apps/admin-panel-e2e/src/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';
10 changes: 10 additions & 0 deletions apps/admin-panel-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts", "src/**/*.js"]
}
11 changes: 11 additions & 0 deletions apps/admin-panel/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": [
[
"@nrwl/react/babel",
{
"runtime": "automatic"
}
]
],
"plugins": []
}
16 changes: 16 additions & 0 deletions apps/admin-panel/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by:
# 1. autoprefixer to adjust CSS to support the below specified browsers
# 2. babel preset-env to adjust included polyfills
#
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
#
# If you need to support different browsers in production, you may tweak the list below.

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major version
last 2 iOS major versions
Firefox ESR
not IE 9-11 # For IE 9-11 support, remove 'not'.
2 changes: 1 addition & 1 deletion apps/admin-panel/.env-template
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# The general .env file should contain
NX_ENVIRONMENT=<environment>
NX_API_URL=<url of the API>
NX_SERVER_PORT=<port of the server>
2 changes: 1 addition & 1 deletion apps/admin-panel/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["../../.eslintrc.json"],
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
Expand Down
9 changes: 2 additions & 7 deletions apps/admin-panel/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
module.exports = {
displayName: 'admin-panel',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
testEnvironment: 'node',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
'^.+\\.[tj]sx?$': 'babel-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/admin-panel',
Expand Down
Empty file removed apps/admin-panel/src/app/.gitkeep
Empty file.
51 changes: 51 additions & 0 deletions apps/admin-panel/src/app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { BrowserRouter as Router, Switch } from 'react-router-dom';
import LoginRoute from './components/loginRoute/LoginRoute';
import PrivateRoute from './components/privateRoute/PrivateRoute';
import JwtVerification from './services/jwtVerification.service';
import HomePage from './pages/home/HomePage';
import LoginPage from './pages/login/LoginPage';
import GradesPage from './pages/resources/grades/GradesPage';
import SubjectsPage from './pages/resources/subjects/SubjectsPage';
import LecturesPage from './pages/resources/lectures/LecturesPage';
import LectureMaterialsPage from './pages/resources/lecture-materials/LectureMaterialsPage';
import VideosPage from './pages/resources/videos/VideosPage';
import RolesPage from './pages/resources/roles/RolesPage';
import UsersPage from './pages/resources/users/UsersPage';

export function App() {
return (
<Router>
<Switch>
<PrivateRoute exact path={['/home', '/']}>
<HomePage />
</PrivateRoute>
<PrivateRoute exact path={['/grades']}>
<GradesPage />
</PrivateRoute>
<PrivateRoute exact path={['/subjects']}>
<SubjectsPage />
</PrivateRoute>
<PrivateRoute exact path={['/lectures']}>
<LecturesPage />
</PrivateRoute>
<PrivateRoute exact path={['/lecture-materials']}>
<LectureMaterialsPage />
</PrivateRoute>
<PrivateRoute exact path={['/videos']}>
<VideosPage />
</PrivateRoute>
<PrivateRoute exact path={['/users']}>
<UsersPage />
</PrivateRoute>
<PrivateRoute exact path={['/roles']}>
<RolesPage />
</PrivateRoute>
<LoginRoute exact path="/login">
<LoginPage />
</LoginRoute>
</Switch>
<JwtVerification />
</Router>
);
}
export default App;
3 changes: 3 additions & 0 deletions apps/admin-panel/src/app/app.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background-color: #b4c6a6;
}
13 changes: 13 additions & 0 deletions apps/admin-panel/src/app/app.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { render } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';
import App from './app';
describe('App', () => {
it('should render successfully', () => {
const { baseElement } = render(
<BrowserRouter>
<App />
</BrowserRouter>
);
expect(baseElement).toBeTruthy();
});
});
29 changes: 29 additions & 0 deletions apps/admin-panel/src/app/components/customCard/CustomCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Card } from 'react-bootstrap';

/**
* Renders a Card with a custom Title, Description, and link button.
* @param {*} props
* >
* - `String` title
* - `String` description
* - `String` buttonText
* - `String` buttonLink - default: `#`
* - `Object` style - custom styling options for the card
*/
export default function CustomCard(props) {
const title = props.title;
const description = props.description;
const buttonText = props.buttonText;
const buttonLink = props.buttonLink || '#';
const customStyle = props.style;

return (
<Card style={{ width: '100%', margin: '15px 0', ...customStyle }}>
<Card.Body>
<Card.Title>{title}</Card.Title>
<Card.Text>{description}</Card.Text>
<Card.Link href={buttonLink}>{buttonText}</Card.Link>
</Card.Body>
</Card>
);
}
21 changes: 21 additions & 0 deletions apps/admin-panel/src/app/components/customTitle/CustomTitle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Container, Row } from 'react-bootstrap';
import style from './CustomTitleStyle';

/**
* Renders a page title with an optional divider underneath.
* @param {*} props
* >
* - `String` title
* - `boolean` hasDivider - toggles the divider on or off.
*/
export default function CustomTitle(props) {
const title = props.value;
const hasDivider = props.hasDivider || true;

return (
<Container style={style.containerStyle}>
<h1 class="fw-light font-monospace">{title}</h1>
{hasDivider && <hr style={style.dividerStyle}></hr>}
</Container>
);
}
Loading