Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'dev' of github.com:erxes/erxes-community into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Wlkr123 committed Oct 25, 2023
2 parents 96609ae + 17fc8a7 commit 79b2d46
Show file tree
Hide file tree
Showing 182 changed files with 5,650 additions and 1,485 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/exm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ on:
branches:
- dev
- staging
- exm-improve
paths:
- 'exm-web/**'
- '.github/workflows/exmweb.yaml'
- '.github/workflows/exm.yaml'

pull_request:
branches:
- dev
- staging
- exm-improve
paths:
- 'exm-web/**'
- '.github/workflows/exmweb.yaml'
- '.github/workflows/exm.yaml'

jobs:
exm-ui:
Expand All @@ -37,9 +39,9 @@ jobs:
yarn build
- name: Build docker image
if: github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/staging')
if: github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/exm-improve')
run: |
cd exm-web
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
DOCKER_BUILDKIT=1 docker build -t erxes/exm:${GITHUB_REF#refs/heads/} -f Dockerfile .
docker push erxes/exm:${GITHUB_REF#refs/heads/}
DOCKER_BUILDKIT=1 docker build -t erxes/exm:dev -f Dockerfile .
docker push erxes/exm:dev
8 changes: 5 additions & 3 deletions .github/workflows/plugin-chats-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- dev
- staging
- build-test
- exm-improve
paths:
- 'packages/api-utils/**'
- 'packages/api-plugin-template.erxes/**'
Expand All @@ -16,6 +17,7 @@ on:
- dev
- staging
- build-test
- exm-improve
paths:
- 'packages/api-utils/**'
- 'packages/api-plugin-template.erxes/**'
Expand Down Expand Up @@ -58,9 +60,9 @@ jobs:
cd dist/main/.erxes/src
- name: Build docker image
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/build-test' )
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/exm-improve' )
run: |
cd dist/plugin-chats-api/.erxes
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker build -t erxes/plugin-chats-api:${GITHUB_REF#refs/heads/} -f Dockerfile .
docker push erxes/plugin-chats-api:${GITHUB_REF#refs/heads/}
docker build -t erxes/plugin-chats-api:dev -f Dockerfile .
docker push erxes/plugin-chats-api:dev
2 changes: 1 addition & 1 deletion .github/workflows/plugin-ebarimt-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
yarn build
- name: Configure AWS credentials
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/build-test')
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/build-test' )
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
2 changes: 1 addition & 1 deletion client-portal/modules/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ export const reorder = (

export const capitalize = (word: string) => {
return word.charAt(0).toUpperCase() + word.slice(1);
}
};
12 changes: 9 additions & 3 deletions exm-web/app/(main)/chats/detail/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import RightSideBar from "@/modules/chat/component/RightSideBar"
import Messages from "@/modules/chat/component/messages/Messages"

export default function Detail() {
return (
<div className="w-full ">
<Messages />
</div>
<>
<div className="w-9/12 border-r">
<Messages />
</div>
<div className="flex h-full w-1/4 flex-col">
<RightSideBar />
</div>
</>
)
}
10 changes: 10 additions & 0 deletions exm-web/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ body {
)
rgb(var(--background-start-rgb));
}

.slick-prev {
left: 0px !important;
z-index: 1 !important;
}

.slick-next {
right: 0px !important;
z-index: 1 !important;
}
18 changes: 12 additions & 6 deletions exm-web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { cn } from "@/lib/utils"
import { Toaster } from "@/components/ui/toaster"

export const metadata: Metadata = {
title: "Exm ",
title: "exm",
description: "exm",
icons: {
icon: "/favicon.png",
Expand All @@ -33,11 +33,17 @@ export default function RootLayout({
type="text/javascript"
src="/js/env.js"
/>
{/* <Script
strategy="beforeInteractive"
type="text/javascript"
src="/js/main.js"
/> */}
<link
rel="stylesheet"
type="text/css"
charSet="UTF-8"
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css"
/>
</head>
<body
className={cn(
Expand Down
43 changes: 43 additions & 0 deletions exm-web/components/AttachmentWithChatPreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"use client"

import { cn } from "@/lib/utils"

import { FilePreview } from "./FilePreview"

export const AttachmentWithChatPreview = ({
attachments,
className,
deleteImage,
isDownload,
}: {
attachments: any[]
className?: string
deleteImage?: (index: number) => void
isDownload?: boolean
}) => {
const renderAttachmentPreview = () => {
if (attachments && attachments.length === 0) {
return null
}

return (
<div id="gallery" className={cn("relative w-full", className)}>
<div className="flex w-full">
{attachments.map((image: any, i: number) => (
<FilePreview
key={i}
fileUrl={image.url}
fileName={image.name}
deleteImage={deleteImage}
fileIndex={i}
isDownload={isDownload}
attachments={attachments}
/>
))}
</div>
</div>
)
}

return <>{renderAttachmentPreview()}</>
}
13 changes: 7 additions & 6 deletions exm-web/components/AttachmentWithPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { useState } from "react"
import { XCircle } from "lucide-react"

import { cn } from "@/lib/utils"

import Image from "./ui/image"
import Image from "@/components/ui/image"

export const AttachmentWithPreview = ({
images,
Expand Down Expand Up @@ -47,20 +46,22 @@ export const AttachmentWithPreview = ({

return (
<div id="gallery" className={cn("relative w-full", className)}>
<div className="relative h-56 overflow-hidden md:h-96">
<div className="relative aspect-[5/3]" data-carousel-item={true}>
<div className="relative h-full overflow-hidden">
<div className="relative" data-carousel-item={true}>
<Image
alt="image"
src={images[index]?.url || ""}
className="w-full h-56 object-contain cursor-pointer"
width={2000}
height={2000}
className="w-full h-full object-contain cursor-pointer max-h-[800px]"
/>
</div>
</div>

{deleteImage && (
<button
type="button"
className="absolute top-0 right-0"
className="absolute top-1 right-1 bg-white p-1 rounded-full"
onClick={() => onDelete(index)}
>
<XCircle size={18} />
Expand Down
163 changes: 163 additions & 0 deletions exm-web/components/FilePreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
import React from "react"
import { ExternalLinkIcon, XCircle } from "lucide-react"

import { readFile } from "@/lib/utils"

import { AttachmentWithPreview } from "./AttachmentWithPreview"
import { Dialog, DialogContent, DialogHeader, DialogTrigger } from "./ui/dialog"
import Image from "./ui/image"

export const FilePreview = ({
fileUrl,
fileName,
deleteImage,
fileIndex,
isDownload,
attachments,
}: {
fileUrl: string
fileName?: string
fileIndex: number
deleteImage?: (index: number) => void
isDownload?: boolean
attachments?: any[]
}) => {
if (!fileUrl || !fileUrl.split) {
return null
}

const onDelete = (index: number) => {
if (deleteImage) {
deleteImage(index)
}

return
}

const renderImageForm = () => {
return (
<DialogContent>
<DialogHeader />
<AttachmentWithPreview images={attachments || []} />
</DialogContent>
)
}

const renderFile = () => {
return (
<div className="relative">
{deleteImage && (
<button
type="button"
className="absolute top-0 bg-white p-1 rounded-full"
onClick={() => onDelete(fileIndex)}
>
<XCircle size={18} />
</button>
)}

{isDownload ? (
<a href={readFile(fileUrl)}>
<div className="mr-1 p-2 rounded-lg bg-[#F0F0F0]">
<div className="flex items-center text-sm font-semibold text-[#444] break-words">
<ExternalLinkIcon size={18} /> {fileName}
</div>{" "}
</div>
</a>
) : (
<div className="mr-1 p-2 rounded-lg bg-[#F0F0F0]">
<div className="flex items-center text-sm font-semibold text-[#444] break-words">
<ExternalLinkIcon size={18} /> {fileName}
</div>{" "}
</div>
)}
</div>
)
}

const renderImagePreview = () => {
if (deleteImage) {
return (
<div className="mr-1 w-[80px] h-[80px] shrink-0">
<button
type="button"
className="absolute top-0 bg-white p-1 rounded-full"
onClick={() => onDelete(fileIndex)}
>
<XCircle size={18} />
</button>

<Image
alt="image"
src={fileUrl || ""}
width={500}
height={500}
className="object-contain w-[80px] h-[80px]"
/>
</div>
)
}

return (
<>
<Dialog>
<DialogTrigger asChild={true}>
<div className="mr-1 w-[80px] h-[80px] shrink-0 cursor-pointer">
<Image
alt="image"
src={fileUrl || ""}
width={500}
height={500}
className="object-contain w-[80px] h-[80px]"
/>
</div>
</DialogTrigger>

{renderImageForm()}
</Dialog>
</>
)
}

const fileExtension = fileUrl.split(".").pop()

let filePreview

switch (fileExtension) {
case "docx":
filePreview = renderFile()
break
case "pptx":
filePreview = renderFile()
break
case "xlsx":
filePreview = renderFile()
break
// case "mp4":
// filePreview = renderVideo()
// break
// case "m3u8":
// filePreview = renderCloudflareStreamVideoFile()
// break
case "jpeg":
case "jpg":
case "gif":
case "png":
filePreview = renderImagePreview()
break
case "zip":
case "csv":
case "doc":
case "ppt":
case "psd":
case "avi":
case "txt":
case "rar":
case "mp3":
case "pdf":
default:
filePreview = renderFile()
}

return filePreview
}
Loading

0 comments on commit 79b2d46

Please sign in to comment.