import{jsxs as i,jsx as e}from"react/jsx-runtime";import{B as a,c as p}from"./ui-components-B24mpb8o.js";import{usePage as x,useForm as N}from"@inertiajs/react";import{ThumbsUp as v,ThumbsDown as w,MessageCircle as y}from"lucide-react";import{useEffect as C}from"react";import"next-themes";import"sonner";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";const se=()=>{const{props:c}=x(),{blog:d,likesCount:u,dislikesCount:h,userReaction:t,commentsCount:r,translate:f}=c,{button:l,common:m}=f,{data:s,setData:g,post:k,processing:o}=N({blog_id:d.id,type:""}),n=b=>{o||g("type",b)};return C(()=>{(s.type==="like"||s.type==="dislike")&&k(route("blogs.like-dislike.toggle"),{preserveScroll:!0})},[s]),i("div",{className:"flex w-full items-center justify-between",children:[i("div",{className:"flex items-center gap-2",children:[i(a,{variant:t==="like"?"default":"outline",size:"sm",onClick:()=>n("like"),disabled:o,className:p("flex items-center gap-2 transition-colors",t==="like"&&"bg-blue-500 text-white hover:bg-blue-600"),children:[e(v,{className:"h-4 w-4"}),e("span",{children:u}),e("span",{className:"sr-only",children:l.like})]}),i(a,{variant:t==="dislike"?"default":"outline",size:"sm",onClick:()=>n("dislike"),disabled:o,className:p("flex items-center gap-2 transition-colors",t==="dislike"&&"bg-red-500 text-white hover:bg-red-600"),children:[e(w,{className:"h-4 w-4"}),e("span",{children:h}),e("span",{className:"sr-only",children:l.dislike})]})]}),i("div",{className:"flex items-center gap-2",children:[e(y,{className:"h-5 w-5"}),i("h3",{className:"text-lg font-semibold",children:[r," ",r>1?m.comments:m.comment]})]})]})};export{se as default};
