From dfee38961114013c58070ac9e36c0a6568cced4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20G=C3=BCm=C3=BC=C5=9F?= Date: Mon, 31 Jul 2023 00:58:36 +0300 Subject: [PATCH 1/8] feat(apps/pano): used toast component for copy link --- apps/kampus/app/layout.tsx | 4 +++- .../app/pano/features/post-list/MoreOptions.tsx | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/kampus/app/layout.tsx b/apps/kampus/app/layout.tsx index 4683159e..abb89755 100644 --- a/apps/kampus/app/layout.tsx +++ b/apps/kampus/app/layout.tsx @@ -1,11 +1,12 @@ import { type ReactNode } from "react"; import { Inter } from "next/font/google"; +import { ToastProvider } from "@kampus/ui-next"; import { RelayEnvironmentProvider } from "~/features/relay/RelayEnvironmentProvider"; import "./globals.css"; -import { ThemeProvider } from "@kampus/ui-next"; +import { ThemeProvider, Toast } from "@kampus/ui-next"; const inter = Inter({ subsets: ["latin"] }); @@ -20,6 +21,7 @@ export default function RootLayout({ children }: { children: ReactNode }) { {children} + diff --git a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx index 3d0bcef5..299d1186 100644 --- a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx +++ b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx @@ -1,3 +1,4 @@ +"use client"; import { MoreHorizontal } from "lucide-react"; import { @@ -6,6 +7,7 @@ import { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, + useToast, } from "@kampus/ui-next"; interface Props { @@ -26,7 +28,7 @@ type Post = { export const MoreOptionsDropdown = ({ post, shareUrl }: Props) => { // const user = useUserContext(); console.log(post, shareUrl); - + const { toast } = useToast(); const ownerItems: JSX.Element[] = []; // if (canUserEdit(user, post)) { // ownerItems.push( @@ -54,7 +56,15 @@ export const MoreOptionsDropdown = ({ post, shareUrl }: Props) => { {ownerItems} - Adresi kopyala + { + toast({ + description: "link kopyalandı", + }); + }} + > + Adresi kopyala + ); From e9097d70b632923920ed85c0611ac877e8dd2f17 Mon Sep 17 00:00:00 2001 From: Can Sirin Date: Tue, 1 Aug 2023 22:27:49 -0700 Subject: [PATCH 2/8] fix(apps/pano): remove unused import --- apps/kampus/app/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/kampus/app/layout.tsx b/apps/kampus/app/layout.tsx index abb89755..b359fcf9 100644 --- a/apps/kampus/app/layout.tsx +++ b/apps/kampus/app/layout.tsx @@ -6,7 +6,7 @@ import { RelayEnvironmentProvider } from "~/features/relay/RelayEnvironmentProvi import "./globals.css"; -import { ThemeProvider, Toast } from "@kampus/ui-next"; +import { ThemeProvider } from "@kampus/ui-next"; const inter = Inter({ subsets: ["latin"] }); From b2a7feb4fd34b4ff7539603acc80431f4d122c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20G=C3=BCm=C3=BC=C5=9F?= <86381278+muhammed-gumus@users.noreply.github.com> Date: Wed, 2 Aug 2023 21:00:54 +0300 Subject: [PATCH 3/8] Update apps/kampus/app/pano/features/post-list/MoreOptions.tsx Co-authored-by: Can Sirin --- apps/kampus/app/pano/features/post-list/MoreOptions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx index 299d1186..05b7cb6c 100644 --- a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx +++ b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx @@ -59,7 +59,7 @@ export const MoreOptionsDropdown = ({ post, shareUrl }: Props) => { { toast({ - description: "link kopyalandı", + description: "Link kopyalandı", }); }} > From 61d0edee7876a851acd3ceaca95eeedff667c0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20G=C3=BCm=C3=BC=C5=9F?= <86381278+muhammed-gumus@users.noreply.github.com> Date: Wed, 2 Aug 2023 21:01:02 +0300 Subject: [PATCH 4/8] Update apps/kampus/app/pano/features/post-list/MoreOptions.tsx Co-authored-by: Can Sirin --- apps/kampus/app/pano/features/post-list/MoreOptions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx index 05b7cb6c..96fe91bc 100644 --- a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx +++ b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx @@ -63,7 +63,7 @@ export const MoreOptionsDropdown = ({ post, shareUrl }: Props) => { }); }} > - Adresi kopyala + Linki kopyala From d3f02a4f27bd3409d010177c7e825de095e3a47a Mon Sep 17 00:00:00 2001 From: muhammed-gumus Date: Sat, 5 Aug 2023 00:40:35 +0300 Subject: [PATCH 5/8] =?UTF-8?q?fix(apps/pano):added=20Link=20Kopyaland?= =?UTF-8?q?=C4=B1=20toast?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/kampus/app/layout.tsx | 5 +- .../pano/features/post-list/MoreOptions.tsx | 3 +- packages/ui/components/index.ts | 1 + packages/ui/components/toast.tsx | 66 ++++++++++--------- packages/ui/components/toaster.tsx | 33 ++++++++++ packages/ui/index.ts | 1 + 6 files changed, 76 insertions(+), 33 deletions(-) create mode 100644 packages/ui/components/toaster.tsx diff --git a/apps/kampus/app/layout.tsx b/apps/kampus/app/layout.tsx index b359fcf9..a32ca968 100644 --- a/apps/kampus/app/layout.tsx +++ b/apps/kampus/app/layout.tsx @@ -1,6 +1,7 @@ import { type ReactNode } from "react"; import { Inter } from "next/font/google"; -import { ToastProvider } from "@kampus/ui-next"; + +import { Toaster } from "@kampus/ui-next"; import { RelayEnvironmentProvider } from "~/features/relay/RelayEnvironmentProvider"; @@ -21,7 +22,7 @@ export default function RootLayout({ children }: { children: ReactNode }) { {children} - + diff --git a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx index 96fe91bc..f9ae7195 100644 --- a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx +++ b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx @@ -1,4 +1,5 @@ "use client"; + import { MoreHorizontal } from "lucide-react"; import { @@ -27,7 +28,7 @@ type Post = { export const MoreOptionsDropdown = ({ post, shareUrl }: Props) => { // const user = useUserContext(); - console.log(post, shareUrl); + //console.log(post, shareUrl); const { toast } = useToast(); const ownerItems: JSX.Element[] = []; // if (canUserEdit(user, post)) { diff --git a/packages/ui/components/index.ts b/packages/ui/components/index.ts index a095b661..0182365b 100644 --- a/packages/ui/components/index.ts +++ b/packages/ui/components/index.ts @@ -17,3 +17,4 @@ export * from "./toast"; export * from "./top-nav"; export * from "./use-toast"; export * from "./user-avatar"; +export * from "./toaster"; \ No newline at end of file diff --git a/packages/ui/components/toast.tsx b/packages/ui/components/toast.tsx index bca7b18c..ff2ac178 100644 --- a/packages/ui/components/toast.tsx +++ b/packages/ui/components/toast.tsx @@ -1,13 +1,12 @@ "use client"; +import * as React from "react" +import * as ToastPrimitives from "@radix-ui/react-toast" +import { cva, type VariantProps } from "class-variance-authority" +import { X } from "lucide-react" -import * as React from "react"; -import * as ToastPrimitives from "@radix-ui/react-toast"; -import { cva, type VariantProps } from "class-variance-authority"; -import { X } from "lucide-react"; +import { cn } from "@kampus/ui-next/utils" -import { cn } from "@kampus/ui-next/utils"; - -const ToastProvider = ToastPrimitives.Provider; +const ToastProvider = ToastPrimitives.Provider const ToastViewport = React.forwardRef< React.ElementRef, @@ -21,28 +20,29 @@ const ToastViewport = React.forwardRef< )} {...props} /> -)); -ToastViewport.displayName = ToastPrimitives.Viewport.displayName; +)) +ToastViewport.displayName = ToastPrimitives.Viewport.displayName const toastVariants = cva( - "data-[swipe=move]:transition-none group relative pointer-events-auto flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full data-[state=closed]:slide-out-to-right-full", + "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full", { variants: { variant: { - default: "bg-background border", + default: "border bg-background", destructive: - "group destructive border-destructive bg-destructive text-destructive-foreground", + "destructive group border-destructive bg-destructive text-destructive-foreground", }, }, defaultVariants: { variant: "default", }, } -); +) const Toast = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef & VariantProps + React.ComponentPropsWithoutRef & + VariantProps >(({ className, variant, ...props }, ref) => { return ( - ); -}); -Toast.displayName = ToastPrimitives.Root.displayName; + ) +}) +Toast.displayName = ToastPrimitives.Root.displayName const ToastAction = React.forwardRef< React.ElementRef, @@ -61,13 +61,13 @@ const ToastAction = React.forwardRef< -)); -ToastAction.displayName = ToastPrimitives.Action.displayName; +)) +ToastAction.displayName = ToastPrimitives.Action.displayName const ToastClose = React.forwardRef< React.ElementRef, @@ -84,16 +84,20 @@ const ToastClose = React.forwardRef< > -)); -ToastClose.displayName = ToastPrimitives.Close.displayName; +)) +ToastClose.displayName = ToastPrimitives.Close.displayName const ToastTitle = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - -)); -ToastTitle.displayName = ToastPrimitives.Title.displayName; + +)) +ToastTitle.displayName = ToastPrimitives.Title.displayName const ToastDescription = React.forwardRef< React.ElementRef, @@ -104,12 +108,12 @@ const ToastDescription = React.forwardRef< className={cn("text-sm opacity-90", className)} {...props} /> -)); -ToastDescription.displayName = ToastPrimitives.Description.displayName; +)) +ToastDescription.displayName = ToastPrimitives.Description.displayName -type ToastProps = React.ComponentPropsWithoutRef; +type ToastProps = React.ComponentPropsWithoutRef -type ToastActionElement = React.ReactElement; +type ToastActionElement = React.ReactElement export { type ToastProps, @@ -121,4 +125,6 @@ export { ToastDescription, ToastClose, ToastAction, -}; +} + + diff --git a/packages/ui/components/toaster.tsx b/packages/ui/components/toaster.tsx new file mode 100644 index 00000000..3cfa19e2 --- /dev/null +++ b/packages/ui/components/toaster.tsx @@ -0,0 +1,33 @@ +"use client"; + +import { + Toast, + ToastClose, + ToastDescription, + ToastProvider, + ToastTitle, + ToastViewport, + useToast, +} from "@kampus/ui-next"; + +export function Toaster() { + const { toasts } = useToast(); + + return ( + + {toasts.map(function ({ id, title, description, action, ...props }) { + return ( + +
+ {title && {title}} + {description && {description}} +
+ {action} + +
+ ); + })} + +
+ ); +} diff --git a/packages/ui/index.ts b/packages/ui/index.ts index 40b494c5..3f521800 100644 --- a/packages/ui/index.ts +++ b/packages/ui/index.ts @@ -1 +1,2 @@ + export * from "./components"; From db5952459540f47861029ad375089d81207e2b49 Mon Sep 17 00:00:00 2001 From: muhammed-gumus Date: Sat, 5 Aug 2023 01:15:01 +0300 Subject: [PATCH 6/8] fix(apps/pano):run prettier --- packages/ui/components/index.ts | 2 +- packages/ui/components/toast.tsx | 68 +++++++++++++++----------------- packages/ui/index.ts | 1 - 3 files changed, 32 insertions(+), 39 deletions(-) diff --git a/packages/ui/components/index.ts b/packages/ui/components/index.ts index 0182365b..f6048f6b 100644 --- a/packages/ui/components/index.ts +++ b/packages/ui/components/index.ts @@ -17,4 +17,4 @@ export * from "./toast"; export * from "./top-nav"; export * from "./use-toast"; export * from "./user-avatar"; -export * from "./toaster"; \ No newline at end of file +export * from "./toaster"; diff --git a/packages/ui/components/toast.tsx b/packages/ui/components/toast.tsx index ff2ac178..f1cc2a53 100644 --- a/packages/ui/components/toast.tsx +++ b/packages/ui/components/toast.tsx @@ -1,12 +1,13 @@ "use client"; -import * as React from "react" -import * as ToastPrimitives from "@radix-ui/react-toast" -import { cva, type VariantProps } from "class-variance-authority" -import { X } from "lucide-react" -import { cn } from "@kampus/ui-next/utils" +import * as React from "react"; +import * as ToastPrimitives from "@radix-ui/react-toast"; +import { cva, type VariantProps } from "class-variance-authority"; +import { X } from "lucide-react"; -const ToastProvider = ToastPrimitives.Provider +import { cn } from "@kampus/ui-next/utils"; + +const ToastProvider = ToastPrimitives.Provider; const ToastViewport = React.forwardRef< React.ElementRef, @@ -20,29 +21,28 @@ const ToastViewport = React.forwardRef< )} {...props} /> -)) -ToastViewport.displayName = ToastPrimitives.Viewport.displayName +)); +ToastViewport.displayName = ToastPrimitives.Viewport.displayName; const toastVariants = cva( - "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full", + "data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none", { variants: { variant: { - default: "border bg-background", + default: "bg-background border", destructive: - "destructive group border-destructive bg-destructive text-destructive-foreground", + "destructive border-destructive bg-destructive text-destructive-foreground group", }, }, defaultVariants: { variant: "default", }, } -) +); const Toast = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef & - VariantProps + React.ComponentPropsWithoutRef & VariantProps >(({ className, variant, ...props }, ref) => { return ( - ) -}) -Toast.displayName = ToastPrimitives.Root.displayName + ); +}); +Toast.displayName = ToastPrimitives.Root.displayName; const ToastAction = React.forwardRef< React.ElementRef, @@ -61,13 +61,13 @@ const ToastAction = React.forwardRef< -)) -ToastAction.displayName = ToastPrimitives.Action.displayName +)); +ToastAction.displayName = ToastPrimitives.Action.displayName; const ToastClose = React.forwardRef< React.ElementRef, @@ -76,7 +76,7 @@ const ToastClose = React.forwardRef< -)) -ToastClose.displayName = ToastPrimitives.Close.displayName +)); +ToastClose.displayName = ToastPrimitives.Close.displayName; const ToastTitle = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - -)) -ToastTitle.displayName = ToastPrimitives.Title.displayName + +)); +ToastTitle.displayName = ToastPrimitives.Title.displayName; const ToastDescription = React.forwardRef< React.ElementRef, @@ -108,12 +104,12 @@ const ToastDescription = React.forwardRef< className={cn("text-sm opacity-90", className)} {...props} /> -)) -ToastDescription.displayName = ToastPrimitives.Description.displayName +)); +ToastDescription.displayName = ToastPrimitives.Description.displayName; -type ToastProps = React.ComponentPropsWithoutRef +type ToastProps = React.ComponentPropsWithoutRef; -type ToastActionElement = React.ReactElement +type ToastActionElement = React.ReactElement; export { type ToastProps, @@ -125,6 +121,4 @@ export { ToastDescription, ToastClose, ToastAction, -} - - +}; diff --git a/packages/ui/index.ts b/packages/ui/index.ts index 3f521800..40b494c5 100644 --- a/packages/ui/index.ts +++ b/packages/ui/index.ts @@ -1,2 +1 @@ - export * from "./components"; From 2b51958e97fcc7b95851380bca30691007f1ddee Mon Sep 17 00:00:00 2001 From: Umut Sirin Date: Fri, 4 Aug 2023 15:19:47 -0700 Subject: [PATCH 7/8] Update apps/kampus/app/pano/features/post-list/MoreOptions.tsx --- apps/kampus/app/pano/features/post-list/MoreOptions.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx index f9ae7195..b2c2e49a 100644 --- a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx +++ b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx @@ -28,7 +28,6 @@ type Post = { export const MoreOptionsDropdown = ({ post, shareUrl }: Props) => { // const user = useUserContext(); - //console.log(post, shareUrl); const { toast } = useToast(); const ownerItems: JSX.Element[] = []; // if (canUserEdit(user, post)) { From b057fb1a833f35e9ad451282d1c8d4a91cee1c6c Mon Sep 17 00:00:00 2001 From: muhammed-gumus Date: Mon, 7 Aug 2023 00:25:05 +0300 Subject: [PATCH 8/8] fix(apps/pano): used unused args --- apps/kampus/app/pano/features/post-list/MoreOptions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx index b2c2e49a..92ab8a7a 100644 --- a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx +++ b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx @@ -28,6 +28,7 @@ type Post = { export const MoreOptionsDropdown = ({ post, shareUrl }: Props) => { // const user = useUserContext(); + console.log(post, shareUrl); const { toast } = useToast(); const ownerItems: JSX.Element[] = []; // if (canUserEdit(user, post)) {