Skip to content

Commit

Permalink
Merge pull request #232 from Peppermint-Lab/next
Browse files Browse the repository at this point in the history
🚀 release
  • Loading branch information
potts99 authored Feb 28, 2024
2 parents d449226 + 4deb013 commit 4da34f5
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 24 deletions.
4 changes: 2 additions & 2 deletions apps/api/src/prisma/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ async function main() {

const conf = await prisma.config.create({
data: {
gh_version: "0.3.6",
client_version: "0.3.6",
gh_version: "0.4.2",
client_version: "0.4,2",
portal_locale: "en",
encryption_key: encryptionKey,
},
Expand Down
1 change: 1 addition & 0 deletions apps/client/layouts/adminLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default function AdminLayout({ children }: any) {
))}
</nav>
</div>

<div className="flex-1 px-6 xl:w-[800px] ">{children}</div>
</div>
</div>
Expand Down
167 changes: 151 additions & 16 deletions apps/client/layouts/newLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Link from "next/link";
import { useRouter } from "next/router";
import { Fragment, useEffect, useState } from "react";

import { ContextMenu } from "@radix-ui/themes";
import { Button, ContextMenu } from "@radix-ui/themes";
import useTranslation from "next-translate/useTranslation";
import { useUser } from "../store/session";

Expand Down Expand Up @@ -76,6 +76,39 @@ export default function NewLayout({ children }: any) {
// },
];

const admin_settings = [
{
name: t("sl_users"),
href: "/admin/users/internal",
current: location.pathname === "/admin/users/internal",
},
{
name: t("sl_clients"),
href: "/admin/clients",
current: location.pathname === "/admin/clients",
},
{
name: "Email Queues",
href: "/admin/email-queues",
current: location.pathname === "/admin/email-queues",
},
{
name: "Webhooks",
href: "/admin/webhooks",
current: location.pathname === "/admin/webhooks",
},
{
name: "Outbound Emails",
href: "/admin/email",
current: location.pathname === "/admin/email",
},
{
name: "SSO",
href: "/admin/sso",
current: location.pathname === "/admin/sso",
},
];

// async function getQueues() {
// const res = await fetch(
// `/api/v1/email-queues/all`,
Expand Down Expand Up @@ -118,8 +151,8 @@ export default function NewLayout({ children }: any) {
// }, [user]);

// useEffect(() => {
// location.push(`${locale}/${location.pathname}`);
// }, [user, location]);
// getQueues();
// }, [user])

// const handleKeyPress = useCallback((event: any, location: any) => {
// console.log(location);
Expand Down Expand Up @@ -260,12 +293,13 @@ export default function NewLayout({ children }: any) {
</Transition.Child>
{/* Sidebar component, swap this element with another sidebar if you like */}
<div className="flex grow flex-col gap-y-5 overflow-y-auto bg-white px-6 pb-4">
<div className="flex h-16 shrink-0 items-center">
<img
className="h-8 w-auto"
src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=600"
alt="Your Company"
/>
<div className="flex align-middle flex-row h-14 items-center border-b-[1px]">
{/* <img className="h-8 w-auto" src="/logo.svg" alt="Workflow" /> */}
<Link href="https://peppermint.sh">
<span className="text-3xl ml-2 hover:text-green-600 font-bold ">
Peppermint
</span>
</Link>
</div>
<nav className="flex flex-1 flex-col">
<ul role="list" className="flex flex-1 flex-col gap-y-7">
Expand Down Expand Up @@ -295,11 +329,6 @@ export default function NewLayout({ children }: any) {
<span className="whitespace-nowrap">
{item.name}
</span>
<div className="flex w-full justify-end float-right">
<span className="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg border border-gray-700 bg-gray-800 text-[0.625rem] font-medium text-gray-400 group-hover:text-white">
{item.initial}
</span>
</div>
</Link>
</li>
) : (
Expand Down Expand Up @@ -363,6 +392,100 @@ export default function NewLayout({ children }: any) {
</ul>
</li>

{user.isAdmin && (
<li>
<span className="mb-2 text-sm font-bold">
Admin Settings
</span>
<ul role="list" className="-mx-2 space-y-1">
{admin_settings.map((item: any) =>
!item.children ? (
<li key={item.name}>
<Link
href={item.href}
className={classNames(
item.current
? "bg-gray-50 text-indigo-600"
: "text-gray-700 hover:text-indigo-600 hover:bg-gray-50",
"group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold"
)}
>
{/* <item.icon
className={classNames(
item.current
? "text-indigo-600"
: "text-gray-400 group-hover:text-indigo-600",
"h-6 w-6 shrink-0"
)}
aria-hidden="true"
/> */}
<span className="whitespace-nowrap">
{item.name}
</span>
</Link>
</li>
) : (
<Disclosure
as="div"
key={item.name}
className="space-y-1"
>
{({ open }) => (
<>
{queues.length > 0 && (
<>
<Disclosure.Button
className={classNames(
item.current
? "bg-green-400 text-white"
: "bg-gray-900 text-white hover:bg-green-400 hover:text-white",
"group w-full flex items-center pl-2 pr-2 py-2 text-left text-sm font-medium rounded-md focus:outline-none"
)}
>
<svg
className={classNames(
open
? "text-white rotate-90"
: "text-white",
"mr-2 flex-shrink-0 h-5 w-5 transform group-hover:text-white transition-colors ease-in-out duration-150"
)}
viewBox="0 0 20 20"
aria-hidden="true"
>
<path
d="M6 6L14 10L6 14V6Z"
fill="currentColor"
/>
</svg>
{item.name}
</Disclosure.Button>
<Disclosure.Panel className="space-y-1">
{item.children.map(
(subItem: any) => (
<Link
href={`/queue/${subItem.name}`}
>
<Disclosure.Button
key={subItem.name}
className="group w-full flex items-center pl-10 pr-2 py-2 text-sm font-medium text-white rounded-md hover:text-white hover:bg-green-400 focus:outline-none"
>
{subItem.name}
</Disclosure.Button>
</Link>
)
)}
</Disclosure.Panel>
</>
)}
</>
)}
</Disclosure>
)
)}
</ul>
</li>
)}

<li className="mt-auto">
<a
href="#"
Expand Down Expand Up @@ -569,11 +692,14 @@ export default function NewLayout({ children }: any) {
<div className="sticky top-0 z-10 flex h-14 shrink-0 items-center gap-x-4 border-b border-gray-200 bg-white dark:bg-[#0A090C] px-4 sm:gap-x-6">
<button
type="button"
className="-m-2.5 p-2.5 text-white lg:hidden"
className="-m-2.5 p-2.5 text-black dark:text-white lg:hidden"
onClick={() => setSidebarOpen(true)}
>
<span className="sr-only">Open sidebar</span>
<Bars3Icon className="h-6 w-6 text-white" aria-hidden="true" />
<Bars3Icon
className="h-6 w-6 text-black dark:text-white"
aria-hidden="true"
/>
</button>

{/* Separator */}
Expand Down Expand Up @@ -697,6 +823,15 @@ export default function NewLayout({ children }: any) {
</Popover.Panel>
</Popover> */}
{/* Profile dropdown */}
<Link
href="https://github.com/Peppermint-Lab/peppermint/discussions"
target="_blank"
className="hover:cursor-pointer"
>
<Button variant="outline" className="hover:cursor-pointer">
Send Feedback
</Button>
</Link>
<Menu as="div" className="relative">
<Menu.Button className="z-50 flex items-center p-1.5">
<span className="sr-only">Open user menu</span>
Expand Down
4 changes: 2 additions & 2 deletions apps/client/pages/auth/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ export default function Login({}) {
return (
<div className="min-h-screen bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="sm:mx-auto sm:w-full sm:max-w-md">
<a target="_blank" href="https://peppermint.sh/">
{/* <a target="_blank" href="https://peppermint.sh/">
<img
className="mx-auto h-36 w-auto"
src="/login.svg"
alt="peppermint.sh logo"
/>
</a>
</a> */}
<h2 className="mt-6 text-center text-3xl font-extrabold text-gray-900">
Sign in to your account
</h2>
Expand Down
52 changes: 48 additions & 4 deletions apps/client/pages/ticket/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useQuery } from "react-query";
import renderHTML from "react-render-html";
// import TextAlign from '@tiptap/extension-text-align';
import { notifications } from "@mantine/notifications";
import { Text, Tooltip } from "@radix-ui/themes";
import { Button, DropdownMenu, Text, Tooltip } from "@radix-ui/themes";
import SubScript from "@tiptap/extension-subscript";
import Superscript from "@tiptap/extension-superscript";
import { getCookie } from "cookies-next";
Expand Down Expand Up @@ -267,6 +267,10 @@ export default function Ticket() {
fetchUsers();
}, []);

useEffect(() => {
transferTicket();
}, [n]);

useEffect(() => {
if (status === "success") {
if (IssueEditor) {
Expand Down Expand Up @@ -332,6 +336,43 @@ export default function Ticket() {
</p>
</div>
<div className="mt-4 flex space-x-3 md:mt-0">
{!edit && (
<DropdownMenu.Root>
<DropdownMenu.Trigger className="hover:cursor-pointer">
<Button variant="outline">Options</Button>
</DropdownMenu.Trigger>
<DropdownMenu.Content className="min-w-[176px] mr-6">
<DropdownMenu.Item
className="min-w-[176px] capitalize hover:cursor-pointer"
onClick={() => setEdit(!edit)}
>
{!edit ? t("edit-btn") : "save"}
</DropdownMenu.Item>

{user.isAdmin && (
<DropdownMenu.Item
className="hover:cursor-pointer"
onClick={() => hide(!data.ticket.hidden)}
>
{data.ticket.hidden
? "Show Global"
: "Hide Ticket"}
</DropdownMenu.Item>
)}
</DropdownMenu.Content>
</DropdownMenu.Root>
)}
{edit && (
<Button
className="hover:cursor-pointer"
variant="outline"
onClick={() => {
update();
setEdit(!edit);
}}
>
save
</Button>
{user.isAdmin && (
<button
type="button"
Expand Down Expand Up @@ -412,9 +453,12 @@ export default function Ticket() {
<>
<div className="relative">
<Listbox.Button className="bg-white z-50 relative w-full border border-gray-300 rounded-md shadow-sm pl-3 pr-10 px-4 py-1.5 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<span className="block truncate">
{n ? n.name : t("select_new_user")}
</span>
<span className="block min-w-[75px] text-xs">
{data.ticket.assignedTo
? data.ticket.assignedTo.name
: n
? n.name
: t("select_new_user")}
</Listbox.Button>

<Transition
Expand Down

0 comments on commit 4da34f5

Please sign in to comment.