-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from xi-effect/staging
Staging
- Loading branch information
Showing
141 changed files
with
8,258 additions
and
4,135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
NEXT_PUBLIC_SERVER_URL_BACKEND=https://api.xieffect.ru | ||
NEXT_PUBLIC_SERVER_URL_AUTH=https://auth.xieffect.ru | ||
NEXT_PUBLIC_SERVER_URL_LIVE=https://live-test.xieffect.ru | ||
NEXT_PUBLIC_SERVER_URL_LIVE=https://live-test.xieffect.ru |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import { Metadata } from 'next'; | ||
// import { get } from 'pkg.utils'; | ||
import InvitePage from './invitePage'; | ||
|
||
// type ResponseBodyT = { | ||
// community: { | ||
// id: number; | ||
// name: string; | ||
// description: string; | ||
// }; | ||
// is_authorized: boolean; | ||
// has_already_joined: boolean; | ||
// }; | ||
|
||
type PageParamsT = { | ||
params: { | ||
iid: string; | ||
}; | ||
}; | ||
|
||
export async function generateMetadata({ params }: PageParamsT): Promise<Metadata> { | ||
// const { status, datas } = await get<ResponseBodyT>({ | ||
// service: 'backend', | ||
// path: `/api/public/community-service/invitations/by-code/${params.iid}/community/`, | ||
// config: { | ||
// headers: { | ||
// 'Content-Type': 'application/json', | ||
// }, | ||
// }, | ||
// }); | ||
|
||
// если использю get из pkg.utils то появляется ошибка: | ||
// импорт компонентов без пометки 'use client' | ||
const data = await fetch( | ||
`${process.env.NEXT_PUBLIC_SERVER_URL_BACKEND}/api/public/community-service/invitations/by-code/${params.iid}/community/`, | ||
).then((res) => res.json()); | ||
|
||
return { | ||
title: `Приглашение в сообщество ${data.community.name}`, | ||
description: `Вы были приглашены в сообщество «${data.community.name}». | ||
Перейдите по этой ссылке-приглашению, чтобы принять приглашение`, | ||
openGraph: { | ||
title: `Приглашение в сообщество ${data.community.name}`, | ||
description: `Вы были приглашены в сообщество «${data.community.name}». | ||
Перейдите по этой ссылке-приглашению, чтобы принять приглашение`, | ||
images: [`https://api.xieffect.ru/files/communities/${data.community.id}/avatar.webp`], | ||
}, | ||
}; | ||
} | ||
|
||
const Invite = ({ params }: PageParamsT) => <InvitePage params={params} />; | ||
|
||
export default Invite; |
2 changes: 0 additions & 2 deletions
2
...-id]/channels/[channel-id]/chats/page.tsx → ...-id]/channels/[channel-id]/chats/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
|
||
export default function Chats() { | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
.../xi.front/app/(protected)/communities/[community-id]/channels/[channel-id]/tasks/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import dynamic from 'next/dynamic'; | ||
|
||
const Tasks = dynamic(() => import('pkg.module.tasks').then((mod) => mod.Tasks)); | ||
|
||
export default function TasksPage() { | ||
return <Tasks />; | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
...app/communities/[community-id]/layout.tsx → ...ed)/communities/[community-id]/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
'use client'; | ||
|
||
import { useMainSt } from 'pkg.stores'; | ||
|
||
import dynamic from 'next/dynamic'; | ||
import { ReactNode } from 'react'; | ||
|
||
const Navigation = dynamic(() => import('pkg.navigation').then((mod) => mod.Navigation)); | ||
|
||
export default function CommunityLayout({ children }: { children: ReactNode }) { | ||
const onSignOut = useMainSt((state) => state.onSignOut); | ||
|
||
return <Navigation onExit={onSignOut}>{children}</Navigation>; | ||
return <Navigation>{children}</Navigation>; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
'use client'; | ||
|
||
import { redirect, useRouter } from 'next/navigation'; | ||
import { Logo } from 'pkg.logo'; | ||
import { useMainSt } from 'pkg.stores'; | ||
import { useEffect } from 'react'; | ||
import { toast } from 'sonner'; | ||
|
||
export default function CommunitiesLoading() { | ||
const isLogin = useMainSt((state) => state.isLogin); | ||
const initSocket = useMainSt((state) => state.initSocket); | ||
const socket = useMainSt((state) => state.socket); | ||
const updateCommunityMeta = useMainSt((state) => state.updateCommunityMeta); | ||
const communityMeta = useMainSt((state) => state.communityMeta); | ||
const onboardingStage = useMainSt((state) => state.user.onboardingStage); | ||
|
||
const router = useRouter(); | ||
|
||
// Тоже костыль | ||
useEffect(() => { | ||
const toastTimerId = setTimeout(() => { | ||
toast('Упс, проблемы с загрузкой'); | ||
initSocket(); | ||
}, 10000); | ||
|
||
const redirectTimerId = setTimeout(() => { | ||
redirect('/communities'); | ||
}, 11000); | ||
|
||
return () => { | ||
clearTimeout(toastTimerId); | ||
clearTimeout(redirectTimerId); | ||
}; | ||
}, []); | ||
|
||
// Если вдруг что-то пошло не так, ещё раз иницируем соединение сокета | ||
// В initSocket есть предотвращение инициализации нескольких соединений | ||
useEffect(() => { | ||
console.log('initSocket'); | ||
initSocket(); | ||
}, []); | ||
|
||
useEffect(() => { | ||
if (isLogin === false) { | ||
redirect('/signin'); | ||
} | ||
}, [isLogin]); | ||
|
||
useEffect(() => { | ||
console.log('onconnect', socket); | ||
if (onboardingStage === 'completed') { | ||
socket?.on('connect', () => { | ||
socket.emit( | ||
'retrieve-any-community', | ||
(stats: number, { community, participant }: { community: any; participant: any }) => { | ||
if (stats === 200) { | ||
updateCommunityMeta({ | ||
id: community.id, | ||
isOwner: participant.is_owner, | ||
name: community.name, | ||
description: community.description, | ||
}); | ||
} | ||
|
||
if (community.id) router.push(`/communities/${community.id}/home`); | ||
}, | ||
); | ||
}); | ||
} | ||
|
||
if (socket?.connected === true && communityMeta.id === null) { | ||
socket.emit( | ||
'retrieve-any-community', | ||
(stats: number, { community, participant }: { community: any; participant: any }) => { | ||
if (stats === 200) { | ||
updateCommunityMeta({ | ||
id: community.id, | ||
isOwner: participant.is_owner, | ||
name: community.name, | ||
description: community.description, | ||
}); | ||
} | ||
|
||
if (community.id) router.push(`/communities/${community.id}/home`); | ||
}, | ||
); | ||
} | ||
}, []); | ||
|
||
useEffect(() => { | ||
if (isLogin && socket?.connected === true) { | ||
socket.emit('retrieve-any-community', | ||
(stats: number, { community, participant }: { community: any; participant: any }) => { | ||
if (stats === 200) { | ||
updateCommunityMeta({ | ||
id: community.id, | ||
isOwner: participant.is_owner, | ||
name: community.name, | ||
description: community.description, | ||
}); | ||
} | ||
|
||
if (community.id) router.push(`/communities/${community.id}/home`); | ||
}, | ||
); | ||
} | ||
}, [isLogin, socket?.connected]); | ||
|
||
return ( | ||
<div className="flex"> | ||
<div className="flex-col min-w-[350px] p-6"> | ||
<div className="p-2"> | ||
<Logo height={16} width={134} logoVariant="navigation" logoSize="default" /> | ||
</div> | ||
<div className="flex h-12 px-2.5 py-2 md:w-[302px] mt-0 sm:mt-8 gap-2 items-center rounded-xl"> | ||
<div className="bg-gray-10 h-[32px] w-[32px] animate-pulse rounded-full shrink-0" /> | ||
<div className="bg-gray-10 h-[24px] w-full animate-pulse rounded-[4px]" /> | ||
</div> | ||
<div className="w-full h-[calc(100dvh-124px)] p-2"> | ||
<ul className="mt-3 flex flex-col gap-4 overflow-hidden sm:mb-[60px]"> | ||
{[...new Array(7)].map((item, index) => ( | ||
<li | ||
key={index.toString()} | ||
className="bg-gray-10 h-[28px] w-full animate-pulse rounded-[4px]" | ||
/> | ||
))} | ||
</ul> | ||
</div> | ||
<div className="fixed bottom-0 flex flex-col pb-6 sm:w-[302px]"> | ||
<div className="flex gap-2 items-center p-2"> | ||
<div className="bg-gray-10 h-[32px] w-[32px] animate-pulse rounded-full shrink-0" /> | ||
<div className="bg-gray-10 h-[24px] w-full animate-pulse rounded-[4px]" /> | ||
</div> | ||
<div className="mt-1 p-2"> | ||
<div className="bg-gray-10 h-[32px] w-full animate-pulse rounded-[4px]" /> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="p-8 w-[calc(100vw-350px)] overflow-auto h-full"> | ||
<div className="pb-8 max-w-[1570px]"> | ||
<div className="flex gap-4 sm:flex-col xl:flex-row"> | ||
<div className="bg-gray-10 h-[48px] w-full animate-pulse rounded-[4px]" /> | ||
<div className="flex gap-2 w-full"> | ||
<div className="bg-gray-10 h-[48px] w-[48px] animate-pulse rounded-full shrink-0" /> | ||
<div className="bg-gray-10 h-[48px] w-full animate-pulse rounded-[4px]" /> | ||
</div> | ||
</div> | ||
<div className="mt-4"> | ||
<div className="bg-gray-10 h-[32px] w-[400px] animate-pulse rounded-[4px]" /> | ||
</div> | ||
</div> | ||
<div className="grid py-8 max-xs:py-4 gap-12 max-w-[1570px] xl:grid-cols-3"> | ||
<div className="flex flex-col gap-2"> | ||
<div className="bg-gray-10 h-[240px] w-full animate-pulse rounded-2xl" /> | ||
<div className="bg-gray-10 h-[32px] w-full animate-pulse rounded-[4px]" /> | ||
<div className="bg-gray-10 h-[72px] w-full animate-pulse rounded-[4px]" /> | ||
</div> | ||
<div className="flex flex-col gap-2"> | ||
<div className="bg-gray-10 h-[240px] w-full animate-pulse rounded-2xl" /> | ||
<div className="bg-gray-10 h-[32px] w-full animate-pulse rounded-[4px]" /> | ||
<div className="bg-gray-10 h-[72px] w-full animate-pulse rounded-[4px]" /> | ||
</div> | ||
<div className="flex flex-col gap-2"> | ||
<div className="bg-gray-10 h-[240px] w-full animate-pulse rounded-2xl" /> | ||
<div className="bg-gray-10 h-[32px] w-full animate-pulse rounded-[4px]" /> | ||
<div className="bg-gray-10 h-[72px] w-full animate-pulse rounded-[4px]" /> | ||
</div> | ||
</div> | ||
<div className="py-8 max-xs:py-4 w-full max-w-[1570px]"> | ||
<div className="bg-gray-10 h-[248px] w-full animate-pulse rounded-2xl" /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ReactNode } from 'react'; | ||
import ProtectedProvider from './providers'; | ||
|
||
type ProtectedLayoutPropsT = { | ||
children: ReactNode; | ||
}; | ||
|
||
const ProtectedLayout = ({ children }: ProtectedLayoutPropsT) => ( | ||
<ProtectedProvider>{children}</ProtectedProvider> | ||
); | ||
export default ProtectedLayout; |
Oops, something went wrong.