Skip to content

Commit

Permalink
Merge pull request #2867 from ever-co/stage
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
evereq authored Aug 8, 2024
2 parents 162072f + e319fe0 commit e1c37b4
Show file tree
Hide file tree
Showing 40 changed files with 1,272 additions and 382 deletions.
11 changes: 10 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"APPSTORE",
"arrowleft",
"asel",
"alldays",
"Authentificate",
"authjs",
"barcodes",
Expand Down Expand Up @@ -74,6 +75,7 @@
"Darkmode",
"datas",
"dataToDisplay",
"daygrid",
"dearmor",
"deepscan",
"Defaul",
Expand Down Expand Up @@ -117,6 +119,7 @@
"Filder",
"filtmembers",
"firstname",
"fullcalendar",
"flaticon",
"fomated",
"Formated",
Expand Down Expand Up @@ -325,6 +328,7 @@
"Transpiles",
"tsbuildinfo",
"typeof",
"timegrid",
"uicolors",
"uidotdev",
"UIUX",
Expand Down Expand Up @@ -356,7 +360,12 @@
"xlcard",
"xlight",
"yellowbox",
"vhidden"
"vhidden",
"POSTHOG",
"posthog",
"pageviews",
"pageleave",
"pageview"
],
"useGitignore": true,
"ignorePaths": [
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/app/services/client/requests/timesheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ type TTasksTimesheetStatisticsParams = {
'taskIds[0]'?: string;
unitOfTime?: 'day';
};

export function tasksTimesheetStatisticsRequest(params: TTasksTimesheetStatisticsParams, bearer_token: string) {
const queries = new URLSearchParams(params);

return serverFetch<ITasksTimesheet[]>({
path: `/timesheet/statistics/tasks?${queries.toString()}`,
method: 'GET',
method: 'POST',
bearer_token,
tenantId: params.tenantId
});
Expand Down
4 changes: 4 additions & 0 deletions apps/web/.env
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@ NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY=

# Chatwoot
NEXT_PUBLIC_CHATWOOT_API_KEY=

# PostHog
NEXT_PUBLIC_POSTHOG_KEY=
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
92 changes: 92 additions & 0 deletions apps/web/app/[locale]/calendar/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
"use client"
import { useOrganizationTeams } from '@app/hooks';
import { fullWidthState } from '@app/stores/fullWidth';
import { clsxm } from '@app/utils';
import HeaderTabs from '@components/pages/main/header-tabs';
import { PeoplesIcon } from 'assets/svg';
import { withAuthentication } from 'lib/app/authenticator';
import { Breadcrumb, Button, Container, Divider } from 'lib/components';
import { SetupFullCalendar } from 'lib/features'
import { Footer, MainLayout } from 'lib/layout';
import { useTranslations } from 'next-intl';
import { useParams } from 'next/navigation';
import React, { useMemo } from 'react'
import { useRecoilValue } from 'recoil';
import { LuCalendarDays } from "react-icons/lu";


const CalendarPage = () => {
const t = useTranslations();
const fullWidth = useRecoilValue(fullWidthState);
const { activeTeam, isTrackingEnabled } = useOrganizationTeams();
const params = useParams<{ locale: string }>();
const currentLocale = params ? params.locale : null;
const breadcrumbPath = useMemo(
() => [
{ title: JSON.parse(t('pages.home.BREADCRUMB')), href: '/' },
{ title: activeTeam?.name || '', href: '/' },
{ title: "CALENDAR", href: `/${currentLocale}/calendar` }
],
[activeTeam?.name, currentLocale, t]
);
return (
<>
<MainLayout
showTimer={isTrackingEnabled}
footerClassName="hidden"
// footerClassName={clsxm("fixed flex flex-col items-end justify-center bottom-0 z-50 bg-white dark:bg-dark-high",!fullWidth && 'left-0 right-0')}
className="h-[calc(100vh-_22px)]"
>
<div className="h-[263.4px] z-10 bg-white dark:bg-dark-high fixed w-full"></div>
<div
className={
'fixed top-20 flex flex-col border-b-[1px] dark:border-[#26272C] z-10 mx-[0px] w-full bg-white dark:bg-dark-high'
}
>
<Container fullWidth={fullWidth}>
<div className="flex bg-white dark:bg-dark-high flex-row items-start justify-between mt-12">
<div className="flex justify-center items-center gap-8 h-10">
<PeoplesIcon className="text-dark dark:text-[#6b7280] h-6 w-6" />
<Breadcrumb paths={breadcrumbPath} className="text-sm" />
</div>
<div className="flex h-10 w-max items-center justify-center gap-1">
<HeaderTabs kanban={true} linkAll={true} />
</div>
</div>
<div className="flex justify-between items-center mt-10 bg-white dark:bg-dark-high py-2">
<h1 className="text-4xl font-semibold ">
CALENDAR
</h1>
<div className='flex items-center space-x-3'>
<button
className=' hover:!bg-gray-100 text-xl h-10 w-10 rounded-lg flex items-center justify-center'>
<LuCalendarDays />
</button>
<button
className='bg-gray-100 text-xl !h-10 !w-10 rounded-lg flex items-center justify-center'>
<LuCalendarDays />
</button>
<Button
variant='primary'
className='bg-primary dark:!bg-primary-light'
>Add Manuel Time
</Button>
</div>
</div>
</Container>
</div>
<div className='mt-[256px] mb-24 '>
<SetupFullCalendar />
</div>
</MainLayout>
<div className="bg-white dark:bg-[#1e2025] w-screen z-[5000] fixed bottom-0">
<Divider />
<Footer
className={clsxm(' justify-between w-full px-0 mx-auto', fullWidth ? 'px-8' : 'x-container')}
/>
</div>
</>
)
}

export default withAuthentication(CalendarPage, { displayName: 'Calender' });
29 changes: 29 additions & 0 deletions apps/web/app/[locale]/integration/posthog/page-view.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use client';

import { usePathname, useSearchParams } from 'next/navigation';
import { useEffect } from 'react';
import { usePostHog } from 'posthog-js/react';
import { POSTHOG_HOST, POSTHOG_KEY } from '@app/constants';

export default function PostHogPageView(): null {
const pathname = usePathname();
const searchParams = useSearchParams();
const posthog = usePostHog();

useEffect(() => {
if (!POSTHOG_KEY.value || !POSTHOG_HOST.value) return;

// Track pageviews
if (pathname && posthog) {
let url = window.origin + pathname;
if (searchParams.toString()) {
url = url + `?${searchParams.toString()}`;
}
posthog.capture('$pageview', {
$current_url: url
});
}
}, [pathname, searchParams, posthog]);

return null;
}
25 changes: 25 additions & 0 deletions apps/web/app/[locale]/integration/posthog/provider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use client';

import { POSTHOG_HOST, POSTHOG_KEY } from '@app/constants';
import posthog from 'posthog-js';
import { PostHogProvider } from 'posthog-js/react';

const key = POSTHOG_KEY.value;
const host = POSTHOG_HOST.value;

if (typeof window !== 'undefined' && key && host) {
posthog.init(key, {
api_host: host,
person_profiles: 'identified_only',
capture_pageview: false,
capture_pageleave: true
});
}

export function PHProvider({ children }: { children: React.ReactNode }) {
if (!key || !host) {
return <>{children}</>;
}

return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
}
5 changes: 2 additions & 3 deletions apps/web/app/[locale]/kanban/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,10 @@ const Kanban = () => {
<div
key={tab.name}
onClick={() => setActiveTab(tab.value)}
className={`cursor-pointer pt-2.5 px-5 pb-[30px] text-base font-semibold ${
activeTab === tab.value
className={`cursor-pointer pt-2.5 px-5 pb-[30px] text-base font-semibold ${activeTab === tab.value
? 'border-b-[#3826A6] text-[#3826A6] dark:text-white dark:border-b-white'
: 'border-b-white dark:border-b-[#191A20] dark:text-white text-[#282048]'
}`}
}`}
style={{
borderBottomWidth: '3px',
borderBottomStyle: 'solid'
Expand Down
53 changes: 32 additions & 21 deletions apps/web/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,20 @@ interface Props {
import { Poppins } from 'next/font/google';
import GlobalSkeleton from '@components/ui/global-skeleton';
import NextAuthSessionProvider from 'lib/layout/next-auth-provider';
import dynamic from 'next/dynamic';
import { PHProvider } from './integration/posthog/provider';

const poppins = Poppins({
subsets: ['latin'],
weight: '500',
variable: '--font-poppins',
display: 'swap'
});

const PostHogPageView = dynamic(() => import('./integration/posthog/page-view'), {
ssr: false
});

// export function generateStaticParams() {
// return locales.map((locale: any) => ({ locale }));
// }
Expand Down Expand Up @@ -124,27 +131,31 @@ const LocaleLayout = ({ children, params: { locale }, pageProps }: Props) => {
)}
</head> */}
<NextIntlClientProvider locale={locale} messages={messages} timeZone="Asia/Kolkata">
<body className={clsx('flex h-full flex-col dark:bg-[#191A20]')}>
<NextAuthSessionProvider>
<RecoilRoot>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{loading && !pathname?.startsWith('/auth') ? (
<GlobalSkeleton />
) : (
<>
<AppState />
<JitsuRoot pageProps={pageProps}>{children}</JitsuRoot>
</>
)}
</ThemeProvider>
</RecoilRoot>
</NextAuthSessionProvider>
</body>
<PHProvider>
<body className={clsx('flex h-full flex-col dark:bg-[#191A20]')}>
<PostHogPageView />

<NextAuthSessionProvider>
<RecoilRoot>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{loading && !pathname?.startsWith('/auth') ? (
<GlobalSkeleton />
) : (
<>
<AppState />
<JitsuRoot pageProps={pageProps}>{children}</JitsuRoot>
</>
)}
</ThemeProvider>
</RecoilRoot>
</NextAuthSessionProvider>
</body>
</PHProvider>
</NextIntlClientProvider>
</html>
);
Expand Down
44 changes: 28 additions & 16 deletions apps/web/app/[locale]/profile/[memberId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { AppsTab } from 'lib/features/activity/apps';
import { VisitedSitesTab } from 'lib/features/activity/visited-sites';
import { activityTypeState } from '@app/stores/activity-type';
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@components/ui/resizable';
import { ActivityCalendar } from 'lib/features/activity/calendar';
// import { ActivityCalendar } from 'lib/features/activity/calendar';

export type FilterTab = 'Tasks' | 'Screenshots' | 'Apps' | 'Visited Sites';

Expand All @@ -41,21 +41,33 @@ const Profile = React.memo(function ProfilePage({ params }: { params: { memberId
const setActivityTypeFilter = useSetRecoilState(activityTypeState);
const hook = useTaskFilter(profile);

const isManagerConnectedUser = activeTeamManagers.findIndex((member) => member.employee?.user?.id == user?.id);
const canSeeActivity = profile.userProfile?.id === user?.id || isManagerConnectedUser != -1;
const isManagerConnectedUser = useMemo(
() => activeTeamManagers.findIndex((member) => member.employee?.user?.id == user?.id),
[activeTeamManagers, user?.id]
);
const canSeeActivity = useMemo(
() => profile.userProfile?.id === user?.id || isManagerConnectedUser != -1,
[isManagerConnectedUser, profile.userProfile?.id, user?.id]
);

const t = useTranslations();
const breadcrumb = [
{ title: activeTeam?.name || '', href: '/' },
{ title: JSON.parse(t('pages.profile.BREADCRUMB')) || '', href: `/profile/${params.memberId}` }
];

const activityScreens = {
Tasks: <UserProfileTask profile={profile} tabFiltered={hook} />,
Screenshots: <ScreenshootTab />,
Apps: <AppsTab />,
'Visited Sites': <VisitedSitesTab />
};
const breadcrumb = useMemo(
() => [
{ title: activeTeam?.name || '', href: '/' },
{ title: JSON.parse(t('pages.profile.BREADCRUMB')) || '', href: `/profile/${params.memberId}` }
],
[activeTeam?.name, params.memberId, t]
);

const activityScreens = useMemo(
() => ({
Tasks: <UserProfileTask profile={profile} tabFiltered={hook} />,
Screenshots: <ScreenshootTab />,
Apps: <AppsTab />,
'Visited Sites': <VisitedSitesTab />
}),
[hook, profile]
);

const profileIsAuthUser = useMemo(() => profile.isAuthUser, [profile.isAuthUser]);
const hookFilterType = useMemo(() => hook.filterType, [hook.filterType]);
Expand Down Expand Up @@ -137,9 +149,9 @@ const Profile = React.memo(function ProfilePage({ params }: { params: { memberId
{/* TaskFilter */}
<TaskFilter profile={profile} hook={hook} />
</MainHeader>
<div className="p-1">
{/* <div className="p-1">
<ActivityCalendar />
</div>
</div> */}
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel defaultSize={65} maxSize={95} className="!overflow-y-scroll custom-scrollbar">
Expand Down
17 changes: 15 additions & 2 deletions apps/web/app/api/livekit/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,21 @@ export async function GET(req: NextRequest) {
}

try {
const at = new AccessToken(apiKey, apiSecret, { identity: username });
at.addGrant({ room, roomJoin: true, canPublish: true, canSubscribe: true, roomRecord: true });
const at = new AccessToken(apiKey, apiSecret, { identity: username, ttl: '1h' });
at.addGrant({
room,
roomJoin: true,
canPublish: true,
canSubscribe: true,
roomRecord: true,
roomCreate: true,
roomAdmin: true,
recorder: true,
roomList: true,
canUpdateOwnMetadata: true,
agent: true,
canPublishData: true,
});
const token = await at.toJwt();
return NextResponse.json({ token: token });
} catch (error) {
Expand Down
Loading

0 comments on commit e1c37b4

Please sign in to comment.