mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
commit
d13468b17f
26 changed files with 42 additions and 28 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# Base image
|
||||
FROM python:3.12-slim-bookworm as base
|
||||
FROM python:3.12.3-slim-bookworm as base
|
||||
|
||||
# Install Nginx, curl, and build-essential
|
||||
RUN apt update && apt install -y nginx curl build-essential \
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
FROM python:3.12
|
||||
FROM python:3.12.3
|
||||
|
||||
# poetry
|
||||
RUN pip install poetry
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { getResponseMetadata } from '@services/utils/ts/requests'
|
|||
import CredentialsProvider from 'next-auth/providers/credentials'
|
||||
import GoogleProvider from 'next-auth/providers/google'
|
||||
|
||||
const isDevEnv = LEARNHOUSE_TOP_DOMAIN == 'localhost' ? true : false
|
||||
export const isDevEnv = LEARNHOUSE_TOP_DOMAIN == 'localhost' ? true : false
|
||||
|
||||
export const nextAuthOptions = {
|
||||
debug: true,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import StyledComponentsRegistry from '../components/Utils/libs/styled-registry'
|
|||
import { motion } from 'framer-motion'
|
||||
import { SessionProvider } from 'next-auth/react'
|
||||
import LHSessionProvider from '@components/Contexts/LHSessionContext'
|
||||
import { isDevEnv } from './auth/options'
|
||||
import Script from 'next/script'
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
|
|
@ -19,6 +21,7 @@ export default function RootLayout({
|
|||
<html className="" lang="en">
|
||||
<head />
|
||||
<body>
|
||||
{isDevEnv ? '' : <Script data-website-id="a1af6d7a-9286-4a1f-8385-ddad2a29fcbb" src="/umami/script.js" />}
|
||||
<SessionProvider>
|
||||
<LHSessionProvider>
|
||||
<StyledComponentsRegistry>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import useSWR from 'swr'
|
|||
function Trail(params: any) {
|
||||
let orgslug = params.orgslug
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const org = useOrg() as any
|
||||
const orgID = org?.id
|
||||
const { data: trail, error: error } = useSWR(
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ export function CourseProvider({ children, courseuuid }: any) {
|
|||
const session = useLHSession() as any;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
|
||||
const { data: courseStructureData, error } = useSWR(
|
||||
access_token ? `${getAPIUrl()}courses/${courseuuid}/meta` : null,
|
||||
const { data: courseStructureData, error } = useSWR(`${getAPIUrl()}courses/${courseuuid}/meta`,
|
||||
url => swrFetcher(url, access_token)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { updateUserAvatar } from '@services/users/users'
|
|||
|
||||
function UserEditGeneral() {
|
||||
const session = useLHSession() as any;
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const [localAvatar, setLocalAvatar] = React.useState(null) as any
|
||||
const [isLoading, setIsLoading] = React.useState(false) as any
|
||||
const [error, setError] = React.useState() as any
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import React, { useEffect } from 'react'
|
|||
|
||||
function UserEditPassword() {
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
|
||||
const updatePasswordUI = async (values: any) => {
|
||||
let user_id = session.data.user.id
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { useLHSession } from '@components/Contexts/LHSessionContext'
|
|||
function OrgAccess() {
|
||||
const org = useOrg() as any
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const { data: invites } = useSWR(
|
||||
org ? `${getAPIUrl()}orgs/${org?.id}/invites` : null,
|
||||
(url) => swrFetcher(url, access_token)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import useSWR, { mutate } from 'swr'
|
|||
function OrgUserGroups() {
|
||||
const org = useOrg() as any
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const [userGroupManagementModal, setUserGroupManagementModal] = React.useState(false)
|
||||
const [createUserGroupModal, setCreateUserGroupModal] = React.useState(false)
|
||||
const [selectedUserGroup, setSelectedUserGroup] = React.useState(null) as any
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import useSWR, { mutate } from 'swr'
|
|||
function OrgUsers() {
|
||||
const org = useOrg() as any
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const { data: orgUsers } = useSWR(
|
||||
org ? `${getAPIUrl()}orgs/${org?.id}/users` : null,
|
||||
(url) => swrFetcher(url, access_token)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import useSWR, { mutate } from 'swr'
|
|||
function OrgUsersAdd() {
|
||||
const org = useOrg() as any
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const [isLoading, setIsLoading] = React.useState(false)
|
||||
const [invitedUsers, setInvitedUsers] = React.useState('');
|
||||
const [selectedInviteCode, setSelectedInviteCode] = React.useState('');
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ type ActivityChatMessageBoxProps = {
|
|||
|
||||
function ActivityChatMessageBox(props: ActivityChatMessageBoxProps) {
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const aiChatBotState = useAIChatBot() as AIChatBotStateTypes
|
||||
const dispatchAIChatBot = useAIChatBotDispatch() as any
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ function AIActionButton(props: {
|
|||
activity: any
|
||||
}) {
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const dispatchAIChatBot = useAIChatBotDispatch() as any
|
||||
const aiChatBotState = useAIChatBot() as AIChatBotStateTypes
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ const UserFeedbackModal = (props: AIEditorToolkitProps) => {
|
|||
const dispatchAIEditor = useAIEditorDispatch() as any
|
||||
const aiEditorState = useAIEditor() as AIEditorStateTypes
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
|
||||
const handleChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
await dispatchAIEditor({
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ interface EditorWrapperProps {
|
|||
|
||||
function EditorWrapper(props: EditorWrapperProps): JSX.Element {
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
// Define provider in the state
|
||||
const [provider, setProvider] = React.useState<HocuspocusProvider | null>(null);
|
||||
const [thisPageColor, setThisPageColor] = useState(randomColor({ luminosity: 'light' }) as string)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ function ImageBlockComponent(props: any) {
|
|||
const course = useCourse() as any
|
||||
const editorState = useEditorProvider() as any
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
|
||||
const isEditable = editorState.isEditable
|
||||
const [image, setImage] = React.useState(null)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ function PDFBlockComponent(props: any) {
|
|||
const org = useOrg() as any
|
||||
const course = useCourse() as any
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const [pdf, setPDF] = React.useState(null)
|
||||
const [isLoading, setIsLoading] = React.useState(false)
|
||||
const [blockObject, setblockObject] = React.useState(
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ function VideoBlockComponents(props: any) {
|
|||
const isEditable = editorState.isEditable
|
||||
const [video, setVideo] = React.useState(null)
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const [isLoading, setIsLoading] = React.useState(false)
|
||||
const [blockObject, setblockObject] = React.useState(
|
||||
props.node.attrs.blockObject
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function LinkToUserGroup(props: LinkToUserGroupProps) {
|
|||
const course = useCourse() as any
|
||||
const org = useOrg() as any
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const courseStructure = course.courseStructure
|
||||
|
||||
const { data: usergroups } = useSWR(
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ type OrgInviteCodeGenerateProps = {
|
|||
function OrgInviteCodeGenerate(props: OrgInviteCodeGenerateProps) {
|
||||
const org = useOrg() as any
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const [usergroup_id, setUsergroup_id] = React.useState(0);
|
||||
const { data: usergroups } = useSWR(
|
||||
org ? `${getAPIUrl()}usergroups/org/${org.id}` : null,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ type AddUserGroupProps = {
|
|||
function AddUserGroup(props: AddUserGroupProps) {
|
||||
const org = useOrg() as any;
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const [userGroupName, setUserGroupName] = React.useState('')
|
||||
const [userGroupDescription, setUserGroupDescription] = React.useState('')
|
||||
const [isSubmitting, setIsSubmitting] = React.useState(false)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ type ManageUsersProps = {
|
|||
function ManageUsers(props: ManageUsersProps) {
|
||||
const org = useOrg() as any
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const { data: OrgUsers } = useSWR(
|
||||
org ? `${getAPIUrl()}orgs/${org.id}/users` : null,
|
||||
swrFetcher
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ interface Props {
|
|||
function RolesUpdate(props: Props) {
|
||||
const org = useOrg() as any
|
||||
const session = useLHSession() as any
|
||||
const access_token = session.data.tokens.access_token;
|
||||
const access_token = session?.data?.tokens?.access_token;
|
||||
const [isSubmitting, setIsSubmitting] = React.useState(false)
|
||||
const [assignedRole, setAssignedRole] = React.useState(
|
||||
props.alreadyAssignedRole
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@ export const config = {
|
|||
* 1. /api routes
|
||||
* 2. /_next (Next.js internals)
|
||||
* 3. /fonts (inside /public)
|
||||
* 4. Umami Analytics
|
||||
* 4. /examples (inside /public)
|
||||
* 5. all root files inside /public (e.g. /favicon.ico)
|
||||
*/
|
||||
'/((?!api|_next|fonts|examples|[\\w-]+\\.\\w+).*)',
|
||||
'/((?!api|_next|fonts|umami|examples|[\\w-]+\\.\\w+).*)',
|
||||
],
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,19 @@
|
|||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: false,
|
||||
output: 'standalone',
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: '/umami/script.js',
|
||||
destination: `https://eu.umami.is/script.js`,
|
||||
},
|
||||
{
|
||||
source: '/umami/api/send',
|
||||
destination: `https://eu.umami.is/api/send`,
|
||||
},
|
||||
]
|
||||
},
|
||||
reactStrictMode: false,
|
||||
output: 'standalone',
|
||||
}
|
||||
|
||||
module.exports = nextConfig
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue