Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1311f351c | ||
|
|
c2fe846c5b | ||
|
|
81533c3342 | ||
|
|
462ba85fe8 | ||
|
|
d0f7dfb87d | ||
|
|
a133cea95c | ||
|
|
4704b404f9 | ||
|
|
55d23f1e47 | ||
|
|
6b07fef62f | ||
|
|
3242576a12 | ||
|
|
a7168231a1 |
24
@types/index.d.ts
vendored
Normal file
24
@types/index.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
declare const IS_PROD: string
|
||||||
|
declare const KC_URL: string
|
||||||
|
declare const KC_REALM: string
|
||||||
|
declare const KC_CLIENT_ID: string
|
||||||
|
|
||||||
|
declare module '*.svg' {
|
||||||
|
const value: string
|
||||||
|
|
||||||
|
export default value
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.jpg' {
|
||||||
|
const value: string
|
||||||
|
|
||||||
|
export default value
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.png' {
|
||||||
|
const value: string
|
||||||
|
|
||||||
|
export default value
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const __webpack_public_path__: string
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
const webpack = require('webpack');
|
||||||
|
|
||||||
const pkg = require('./package')
|
const pkg = require('./package')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -6,6 +8,13 @@ module.exports = {
|
|||||||
output: {
|
output: {
|
||||||
publicPath: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/`,
|
publicPath: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/`,
|
||||||
},
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
KC_URL: process.env.KC_URL || '"https://kc.bro-js.ru"',
|
||||||
|
KC_REALM: process.env.KC_REALM || '"bro-js"',
|
||||||
|
KC_CLIENT_ID: process.env.KC_CLIENT_ID || '"microfrontend-admin"',
|
||||||
|
}),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
navigations: {
|
navigations: {
|
||||||
'journal.main': '/journal.pl',
|
'journal.main': '/journal.pl',
|
||||||
6
index.d.ts
vendored
6
index.d.ts
vendored
@@ -1,6 +0,0 @@
|
|||||||
declare module '*.svg' {
|
|
||||||
const src: string;
|
|
||||||
export default src;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare const __webpack_public_path__: string;
|
|
||||||
5648
package-lock.json
generated
5648
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "journal.pl",
|
"name": "journal.pl",
|
||||||
"version": "3.6.5",
|
"version": "3.6.8",
|
||||||
"description": "bro-js platform journal ui repo",
|
"description": "bro-js platform journal ui repo",
|
||||||
"main": "./src/index.tsx",
|
"main": "./src/index.tsx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"eslint-plugin-react": "^7.34.1"
|
"eslint-plugin-react": "^7.34.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@brojs/cli": "^0.0.4-beta.0",
|
"@brojs/cli": "^1.8.4",
|
||||||
"@chakra-ui/icons": "^2.1.1",
|
"@chakra-ui/icons": "^2.1.1",
|
||||||
"@chakra-ui/react": "^2.8.2",
|
"@chakra-ui/react": "^2.8.2",
|
||||||
"@emotion/react": "^11.11.4",
|
"@emotion/react": "^11.11.4",
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
"js-sha256": "^0.11.0",
|
"js-sha256": "^0.11.0",
|
||||||
"keycloak-js": "^23.0.7",
|
"keycloak-js": "^26.0.7",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.5",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import Keycloak from 'keycloak-js';
|
import Keycloak from 'keycloak-js'
|
||||||
|
|
||||||
export const keycloak = new Keycloak({
|
export const keycloak = new Keycloak({
|
||||||
url: 'https://kc.bro-js.ru',
|
url: KC_URL,
|
||||||
realm: 'bro-js',
|
realm: KC_REALM,
|
||||||
clientId: 'journal'
|
clientId: KC_CLIENT_ID,
|
||||||
});
|
});
|
||||||
|
|
||||||
window.keycloak = keycloak;
|
(window as any).kc = keycloak
|
||||||
@@ -17,11 +17,18 @@ let rootElement: ReactDOM.Root
|
|||||||
export const mount = async (Component, element = document.getElementById('app')) => {
|
export const mount = async (Component, element = document.getElementById('app')) => {
|
||||||
let user = null;
|
let user = null;
|
||||||
try {
|
try {
|
||||||
await keycloak.init({ onLoad: "login-required" });
|
await keycloak.init({ onLoad: 'login-required' })
|
||||||
user = { ...(await keycloak.loadUserInfo()), ...keycloak.tokenParsed };
|
|
||||||
|
const userInfo = await keycloak.loadUserInfo()
|
||||||
|
|
||||||
|
if (userInfo && keycloak.tokenParsed) {
|
||||||
|
user = { ...userInfo, ...keycloak.tokenParsed }
|
||||||
|
} else {
|
||||||
|
console.error('No userInfo or tokenParsed', userInfo, keycloak.tokenParsed)
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to initialize adapter:", error);
|
console.error('Failed to initialize adapter:', error)
|
||||||
keycloak.login();
|
keycloak.login()
|
||||||
}
|
}
|
||||||
const store = createStore({ user });
|
const store = createStore({ user });
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { Link as ConnectedLink } from 'react-router-dom'
|
import { Link as ConnectedLink } from 'react-router-dom'
|
||||||
import { getNavigationsValue, getHistory } from '@brojs/cli'
|
import { getNavigationValue, getHistory } from '@brojs/cli'
|
||||||
import { Stack, Heading, Link, Button, Tooltip, Box } from '@chakra-ui/react'
|
import { Stack, Heading, Link, Button, Tooltip, Box } from '@chakra-ui/react'
|
||||||
|
|
||||||
import { useAppSelector } from '../../__data__/store'
|
import { useAppSelector } from '../../__data__/store'
|
||||||
@@ -27,23 +27,23 @@ export const CourseDetails = ({ populatedCourse }: CourseDetailsProps) => {
|
|||||||
{isTeacher(user) && (
|
{isTeacher(user) && (
|
||||||
<Heading as="h3" mt={4} mb={3} size="lg">
|
<Heading as="h3" mt={4} mb={3} size="lg">
|
||||||
Экзамен: {exam?.name}{' '}
|
Экзамен: {exam?.name}{' '}
|
||||||
{exam && (
|
{exam && getNavigationValue('exam.main') && getNavigationValue('link.exam.details') && (
|
||||||
<Tooltip label="Начать экзамен" fontSize="12px" top="16px">
|
<Tooltip label="Начать экзамен" fontSize="12px" top="16px">
|
||||||
<Button
|
<Button
|
||||||
leftIcon={<LinkIcon />}
|
leftIcon={<LinkIcon />}
|
||||||
as={'a'}
|
as={'a'}
|
||||||
colorScheme="blue"
|
colorScheme="blue"
|
||||||
href={
|
href={
|
||||||
getNavigationsValue('exam.main') +
|
getNavigationValue('exam.main') +
|
||||||
getNavigationsValue('link.exam.details')
|
getNavigationValue('link.exam.details')
|
||||||
.replace(':courseId', populatedCourse.id)
|
.replace(':courseId', populatedCourse.id)
|
||||||
.replace(':examId', exam.id)
|
.replace(':examId', exam.id)
|
||||||
}
|
}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
history.push(
|
history.push(
|
||||||
getNavigationsValue('exam.main') +
|
getNavigationValue('exam.main') +
|
||||||
getNavigationsValue('link.exam.details')
|
getNavigationValue('link.exam.details')
|
||||||
.replace(':courseId', populatedCourse.id)
|
.replace(':courseId', populatedCourse.id)
|
||||||
.replace(':examId', exam.id),
|
.replace(':examId', exam.id),
|
||||||
)
|
)
|
||||||
@@ -95,7 +95,7 @@ export const CourseDetails = ({ populatedCourse }: CourseDetailsProps) => {
|
|||||||
key={lesson.id}
|
key={lesson.id}
|
||||||
to={
|
to={
|
||||||
isTeacher(user)
|
isTeacher(user)
|
||||||
? `${getNavigationsValue('journal.main')}/lesson/${populatedCourse.id}/${lesson.id}`
|
? `${getNavigationValue('journal.main')}/lesson/${populatedCourse.id}/${lesson.id}`
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": [
|
"lib": ["dom", "es2017"],
|
||||||
"dom",
|
|
||||||
"es2017"
|
|
||||||
],
|
|
||||||
"outDir": "./dist/",
|
"outDir": "./dist/",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"typeRoots": ["node_modules/@types", "src/typings"],
|
"typeRoots": ["node_modules/@types", "./@types"],
|
||||||
"types": ["webpack-env", "node"],
|
"types": ["webpack-env", "node"],
|
||||||
"resolveJsonModule": true
|
"resolveJsonModule": true,
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"skipLibCheck": true,
|
||||||
},
|
},
|
||||||
|
"types": [
|
||||||
|
"@types/*"
|
||||||
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"**/*.test.ts",
|
"**/*.test.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user