Skip to content

Commit

Permalink
New module - Mail
Browse files Browse the repository at this point in the history
- added new mail frontend from shadcn ui examples
- added  new route for imap data fetching /api/emails/imap
- added new menu item "E-mails"

Updated Prisma scheme
- cleaned system_Modules_Enabled schema
- unused field was deleted

Updated Locales
- added new meu item localization
  • Loading branch information
pdovhomilja committed Dec 23, 2023
1 parent 0f3230f commit ecc2ffb
Show file tree
Hide file tree
Showing 23 changed files with 1,764 additions and 71 deletions.
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ You can try it here [demo.nextcrm.io](https://demo.nextcrm.io), login via Google

## What we plan to build next

1. More AI powered - daily summary of tasks and project (OpenAI integration) - in test
1. More AI powered - daily summary of tasks and project (OpenAI integration) - in progress
2. Email campaigns management - integration with MailChimp and Listmonk - in planning
3. ~~Docker version - in planning (There will be complete bundle to run NextCRM on-premise)~~
4. Testing - Jest + Cypress (if anyone want to help I will be very happy) - in planning
5. Fix all Types issue (no more "any") - in progress
6. i18n - localization - in planning (if anyone want to help I will be very happy)
6. i18n - localization - in progress (if anyone want to help I will be very happy)
7. Turborepo - in planning
8. Upgrade to Next.js 14 - in planning
9. Email client - in planning

## Emails

Expand All @@ -33,7 +36,7 @@ We use Tremor charts as a tool for creating charts in NextCRM

## Video (YouTube channel with functions showcase)

[Youtube Channel](https://www.youtube.com/@NextCRM_IO) </br>
[Youtube Channel](https://www.youtube.com/@NextCRM_IO) </br>
[Invoice module (video)](https://youtu.be/NSMsBMy07Pg)

## Documentation
Expand Down Expand Up @@ -62,6 +65,7 @@ Available soon at: http://docs.nextcrm.io
```sh
cp .env.example .env
```

```sh
cp .env.local.example .env.local
```
Expand All @@ -83,21 +87,20 @@ Available soon at: http://docs.nextcrm.io
```sh
npx prisma generate
npx prisma db push
npx prisma seed
```

1. Run app on local
1. Import initial data from initial-data folder

```sh
npm run dev
npx prisma db seed
```

1. Import initial data from initial-data folder
1. Run app on local

```sh
npx prisma db seed
npm run dev
```

1. http://localhost:3000

</details>
Expand Down
6 changes: 6 additions & 0 deletions app/[locale]/(routes)/components/ModuleMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import CrmModuleMenu from "./menu-items/Crm";

import AdministrationMenu from "./menu-items/Administration";
import DashboardMenu from "./menu-items/Dashboard";
import EmailsModuleMenu from "./menu-items/Emails";

type Props = {
modules: any;
Expand Down Expand Up @@ -69,6 +70,11 @@ const ModuleMenu = ({ modules, dict }: Props) => {
) ? (
<ProjectModuleMenu open={open} title={dict.ModuleMenu.projects} />
) : null}
{modules.find(
(menuItem: any) => menuItem.name === "emails" && menuItem.enabled
) ? (
<EmailsModuleMenu open={open} title={dict.ModuleMenu.emails} />
) : null}
{modules.find(
(menuItem: any) =>
menuItem.name === "secondBrain" && menuItem.enabled
Expand Down
6 changes: 3 additions & 3 deletions app/[locale]/(routes)/components/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const SideBar = async () => {
const modules = await getModules();
const session = await getServerSession(authOptions);

if (!session) return null;
//console.log(modules, "modules");

const userId = session?.user?.id;
if (!session) return null;

//Get user language
const lang = session?.user?.userLanguage;
const lang = session.user.userLanguage;

//Fetch translations from dictionary
const dict = await getDictionary(lang as "en" | "cz" | "de");
Expand Down
30 changes: 30 additions & 0 deletions app/[locale]/(routes)/components/menu-items/Emails.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Mail } from "lucide-react";

import Link from "next/link";

import { usePathname } from "next/navigation";
import React from "react";

type Props = {
open: boolean;
title: string;
};

const EmailsModuleMenu = ({ open, title }: Props) => {
const pathname = usePathname();
const isPath = pathname.includes("emails");

return (
<div className="flex flex-row items-center mx-auto p-2">
<Link
href={"/emails"}
className={`flex gap-2 p-2 ${isPath ? "text-muted-foreground" : null}`}
>
<Mail className="w-6" />
<span className={open ? "" : "hidden"}>{title}</span>
</Link>
</div>
);
};

export default EmailsModuleMenu;
63 changes: 63 additions & 0 deletions app/[locale]/(routes)/emails/components/account-switcher.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"use client";

import * as React from "react";

import { cn } from "@/lib/utils";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";

interface AccountSwitcherProps {
isCollapsed: boolean;
accounts: {
label: string;
email: string;
icon: React.ReactNode;
}[];
}

export function AccountSwitcher({
isCollapsed,
accounts,
}: AccountSwitcherProps) {
const [selectedAccount, setSelectedAccount] = React.useState<string>(
accounts[0].email
);

return (
<Select defaultValue={selectedAccount} onValueChange={setSelectedAccount}>
<SelectTrigger
className={cn(
"flex flex-1 items-center gap-2 [&>span]:line-clamp-1 [&>span]:flex [&>span]:w-full [&>span]:items-center [&>span]:gap-1 [&>span]:truncate [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",
isCollapsed &&
"flex h-8 w-8 items-center justify-center p-0 [&>span]:w-auto [&>svg]:hidden"
)}
aria-label="Select account"
>
<SelectValue placeholder="Select an account">
{accounts.find((account) => account.email === selectedAccount)?.icon}
<span className={cn("ml-2", isCollapsed && "hidden")}>
{
accounts.find((account) => account.email === selectedAccount)
?.label
}
</span>
</SelectValue>
</SelectTrigger>
<SelectContent>
{accounts.map((account) => (
<SelectItem key={account.email} value={account.email}>
<div className="flex items-center gap-3 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0 [&_svg]:text-foreground">
{account.icon}
{account.email}
</div>
</SelectItem>
))}
</SelectContent>
</Select>
);
}
Loading

3 comments on commit ecc2ffb

@vercel
Copy link

@vercel vercel bot commented on ecc2ffb Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextcrm-test – ./

nextcrm-test-e-osvc.vercel.app
test.nextcrm.io
nextcrm-test-git-main-e-osvc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on ecc2ffb Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextcrm-demo – ./

nextcrm-demo-e-osvc.vercel.app
nextcrm-demo-git-main-e-osvc.vercel.app
demo.nextcrm.io

@vercel
Copy link

@vercel vercel bot commented on ecc2ffb Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.