@myrjfa/ui 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,5 +6,5 @@ export function ActionButtons(_a) {
6
6
  var actions = _a.actions, _b = _a.includeMoreMenu, includeMoreMenu = _b === void 0 ? true : _b, _c = _a.maxDisplayed, maxDisplayed = _c === void 0 ? 0 : _c;
7
7
  var displayedActions = actions.slice(0, maxDisplayed);
8
8
  var menuActions = includeMoreMenu ? actions.slice(maxDisplayed) : [];
9
- return (_jsxs("div", { className: "flex items-center gap-2", children: [displayedActions.map(function (action, index) { return (_jsxs(Button, { variant: action.variant || 'outline', size: "sm", onClick: action.action, className: 'cursor-pointer', children: [action.icon, _jsx("span", { className: "ml-1 md:flex hidden", children: action.label })] }, index)); }), menuActions.length > 0 && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", size: "sm", children: _jsx(MoreHorizontal, { className: "h-4 w-4 cursor-pointer" }) }) }), _jsx(DropdownMenuContent, { align: "end", children: menuActions.map(function (action, index) { return (_jsxs(DropdownMenuItem, { onClick: action.action, children: [action.icon, _jsx("span", { className: "ml-2", children: action.label })] }, index)); }) })] }))] }));
9
+ return (_jsxs("div", { className: "flex items-center gap-2", children: [displayedActions.map(function (action, index) { return (_jsxs(Button, { variant: action.variant || 'outline', size: "sm", onClick: action.action, className: 'cursor-pointer', children: [action.icon, _jsx("span", { className: "ml-1", children: action.label })] }, index)); }), menuActions.length > 0 && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", size: "sm", children: _jsx(MoreHorizontal, { className: "h-4 w-4 cursor-pointer" }) }) }), _jsx(DropdownMenuContent, { align: "end", children: menuActions.map(function (action, index) { return (_jsxs(DropdownMenuItem, { onClick: action.action, children: [action.icon, _jsx("span", { className: "ml-2", children: action.label })] }, index)); }) })] }))] }));
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../src/dashboard/data-table.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,GAAG,EAAqB,MAAM,OAAO,CAAC;AAWtD,MAAM,WAAW,MAAM,CAAC,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC,CAAC;IACrB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,cAAc,CAAC,CAAC;IACtB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EACjE,IAAI,EACJ,OAAO,EACP,OAAO,EACP,UAAU,GACb,EAAE,cAAc,CAAC,CAAC,CAAC,2CA2HnB"}
1
+ {"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../src/dashboard/data-table.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,GAAG,EAAqB,MAAM,OAAO,CAAC;AAYtD,MAAM,WAAW,MAAM,CAAC,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC,CAAC;IACrB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,cAAc,CAAC,CAAC;IACtB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EACjE,IAAI,EACJ,OAAO,EACP,OAAO,EACP,UAAU,GACb,EAAE,cAAc,CAAC,CAAC,CAAC,2CAuNnB"}
@@ -7,7 +7,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7
7
  }
8
8
  return to.concat(ar || Array.prototype.slice.call(from));
9
9
  };
10
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import { ChevronDown, ChevronUp, Inbox } from 'lucide-react';
12
12
  import { useMemo, useState } from 'react';
13
13
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '../dashboard/table';
@@ -50,10 +50,17 @@ export function DataTable(_a) {
50
50
  setSortDirection('asc');
51
51
  }
52
52
  };
53
- return (_jsxs("div", { className: "w-full overflow-auto", children: [_jsx("div", { className: "p-2", children: _jsx(Input, { placeholder: "Search...", className: "mb-4 max-w-sm", value: searchQuery, onChange: function (e) { return setSearchQuery(e.target.value); } }) }), _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [columns.map(function (column) { return (_jsx(TableHead, { className: "cursor-pointer select-none", onClick: function () { return column.sortable && toggleSort(column.accessorKey); }, children: _jsxs("div", { className: "flex items-center gap-1", children: [column.header, column.sortable && (sortColumn === column.accessorKey ? (sortDirection === 'asc' ? (_jsx(ChevronUp, { className: "w-4 h-4 text-black" })) : (_jsx(ChevronDown, { className: "w-4 h-4 text-black" }))) : (_jsxs("div", { className: "flex flex-col text-gray-400 leading-none", children: [_jsx(ChevronUp, { className: "w-3 h-3 -mb-1" }), _jsx(ChevronDown, { className: "w-3 h-3" })] })))] }) }, column.accessorKey)); }), actions && _jsx(TableHead, { children: "Actions" })] }) }), _jsx(TableBody, { children: sortedData.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length + (actions ? 1 : 0), className: "h-40 text-center text-gray-500", children: _jsxs("div", { className: "flex flex-col items-center justify-center gap-2", children: [_jsx(Inbox, { className: "w-8 h-8 text-gray-400" }), _jsx("span", { className: "text-base font-medium", children: "No data available" })] }) }) })) : (sortedData.map(function (item) {
54
- var key = item.slug || item._id || Math.random().toString();
55
- return (_jsxs(TableRow, { onClick: function () { return onRowClick && onRowClick(key); }, className: onRowClick ? 'hover:bg-accent cursor-pointer' : '', children: [columns.map(function (column) { return (_jsx(TableCell, { children: column.cell
56
- ? column.cell(item)
57
- : item[column.accessorKey] }, column.accessorKey)); }), actions && (_jsx(TableCell, { onClick: function (e) { return e.stopPropagation(); }, children: actions(item) }))] }, key));
58
- })) })] })] }));
53
+ return (_jsxs("div", { className: "w-full", children: [_jsx("div", { className: "p-2", children: _jsx(Input, { placeholder: "Search...", className: "mb-4 max-w-sm", value: searchQuery, onChange: function (e) { return setSearchQuery(e.target.value); } }) }), _jsx("div", { className: "hidden lg:block overflow-auto", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [columns.map(function (column) { return (_jsx(TableHead, { className: "cursor-pointer select-none", onClick: function () { return column.sortable && toggleSort(column.accessorKey); }, children: _jsxs("div", { className: "flex items-center gap-1", children: [column.header, column.sortable && (sortColumn === column.accessorKey ? (sortDirection === 'asc' ? (_jsx(ChevronUp, { className: "w-4 h-4 text-black" })) : (_jsx(ChevronDown, { className: "w-4 h-4 text-black" }))) : (_jsxs("div", { className: "flex flex-col text-gray-400 leading-none", children: [_jsx(ChevronUp, { className: "w-3 h-3 -mb-1" }), _jsx(ChevronDown, { className: "w-3 h-3" })] })))] }) }, column.accessorKey)); }), actions && _jsx(TableHead, { children: "Actions" })] }) }), _jsx(TableBody, { children: sortedData.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length + (actions ? 1 : 0), className: "h-40 text-center text-gray-500", children: _jsxs("div", { className: "flex flex-col items-center justify-center gap-2", children: [_jsx(Inbox, { className: "w-8 h-8 text-gray-400" }), _jsx("span", { className: "text-base font-medium", children: "No data available" })] }) }) })) : (sortedData.map(function (item) {
54
+ var key = item.slug || item._id || Math.random().toString();
55
+ return (_jsxs(TableRow, { onClick: function () { return onRowClick && onRowClick(key); }, className: onRowClick ? 'hover:bg-accent cursor-pointer' : '', children: [columns.map(function (column) { return (_jsx(TableCell, { children: column.cell
56
+ ? column.cell(item)
57
+ : item[column.accessorKey] }, column.accessorKey)); }), actions && (_jsx(TableCell, { onClick: function (e) { return e.stopPropagation(); }, children: actions(item) }))] }, key));
58
+ })) })] }) }), _jsx("div", { className: "lg:hidden", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsx(TableRow, { children: columns.slice(1).map(function (column) { return (_jsx(TableHead, { className: "cursor-pointer select-none", onClick: function () { return column.sortable && toggleSort(column.accessorKey); }, children: _jsxs("div", { className: "flex items-center gap-1", children: [column.header, column.sortable && (sortColumn === column.accessorKey ? (sortDirection === 'asc' ? (_jsx(ChevronUp, { className: "w-4 h-4 text-black" })) : (_jsx(ChevronDown, { className: "w-4 h-4 text-black" }))) : (_jsxs("div", { className: "flex flex-col text-gray-400 leading-none", children: [_jsx(ChevronUp, { className: "w-3 h-3 -mb-1" }), _jsx(ChevronDown, { className: "w-3 h-3" })] })))] }) }, column.accessorKey)); }) }) }), _jsx(TableBody, { children: sortedData.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length + (actions ? 1 : 0), className: "h-40 text-center text-gray-500", children: _jsxs("div", { className: "flex flex-col items-center justify-center gap-2", children: [_jsx(Inbox, { className: "w-8 h-8 text-gray-400" }), _jsx("span", { className: "text-base font-medium", children: "No data available" })] }) }) })) : (sortedData.map(function (item) {
59
+ var key = item.slug || item._id || Math.random().toString();
60
+ return (_jsxs(_Fragment, { children: [_jsx(TableRow, { className: "bg-gray-100", children: _jsx(TableCell, { colSpan: columns.length - 1, className: "py-3", children: _jsx("div", { className: "font-semibold text-gray-900", children: columns[0].cell
61
+ ? columns[0].cell(item)
62
+ : item[columns[0].accessorKey] }) }) }), _jsx(TableRow, { onClick: function () { return onRowClick && onRowClick(key); }, className: onRowClick ? 'hover:bg-accent cursor-pointer' : '', children: columns.slice(1).map(function (column) { return (_jsx(TableCell, { children: column.cell
63
+ ? column.cell(item)
64
+ : item[column.accessorKey] }, column.accessorKey)); }) }, key), actions && (_jsx(TableRow, { className: "bg-gray-30", children: _jsx(TableCell, { colSpan: columns.length - 1, className: "py-3", onClick: function (e) { return e.stopPropagation(); }, children: actions(item) }) }))] }));
65
+ })) })] }) })] }));
59
66
  }
@@ -0,0 +1,7 @@
1
+ import { PortfolioItem } from '@myrjfa/state/dist/lib/models/portfolio';
2
+ import { MouseEventHandler } from 'react';
3
+ export declare function PortfolioItemComponent({ item, onClick }: {
4
+ item: PortfolioItem;
5
+ onClick: MouseEventHandler<HTMLDivElement> | undefined;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=portfolioItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portfolioItem.d.ts","sourceRoot":"","sources":["../../../src/main/portfolio/portfolioItem.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACtD,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,iBAAiB,CAAC,cAAc,CAAC,GAAG,SAAS,CAAA;CACzD,2CA2BA"}
@@ -0,0 +1,8 @@
1
+ // components/PortfolioItem.tsx
2
+ 'use client';
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import Image from 'next/image';
5
+ export function PortfolioItemComponent(_a) {
6
+ var item = _a.item, onClick = _a.onClick;
7
+ return _jsxs("div", { className: "relative aspect-square group cursor-pointer rounded-md overflow-hidden border border-gray-200", onClick: onClick, children: [item.mediaType === 'video' ? (_jsx("video", { src: item.url, muted: true, loop: true, playsInline: true, preload: "metadata", className: "object-cover w-full h-full" })) : (_jsx(Image, { src: item.url, alt: item.caption, fill: true, sizes: "(max-width: 768px) 50vw, 33vw", className: "object-cover transition-transform duration-300 group-hover:scale-105", loading: "lazy" })), _jsx("div", { className: "absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-all duration-300 flex items-center justify-center", children: _jsx("div", { className: "text-white p-3 text-center text-sm opacity-0 group-hover:opacity-100 line-clamp-3", children: item.caption }) })] });
8
+ }
@@ -0,0 +1,8 @@
1
+ import { PortfolioItem } from '@myrjfa/state/dist/lib/models/portfolio';
2
+ export declare function PortfolioPopUp({ items, currentIndex, firstName, profilePic }: {
3
+ items: PortfolioItem[];
4
+ currentIndex: number;
5
+ firstName: string;
6
+ profilePic?: string;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=portfolioPopup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portfolioPopup.d.ts","sourceRoot":"","sources":["../../../src/main/portfolio/portfolioPopup.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAIxE,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE;IAC3E,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,2CA0LA"}
@@ -0,0 +1,72 @@
1
+ // components/PortfolioModal.tsx
2
+ 'use client';
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { useState, useRef } from 'react';
5
+ import Image from 'next/image';
6
+ import { Button } from '../../misc/button';
7
+ import { ExternalLink, ChevronLeft, ChevronRight } from 'lucide-react';
8
+ import ShareButton from '../../misc/share';
9
+ import { Avatar, AvatarFallback, AvatarImage } from '../../misc/avatar';
10
+ export function PortfolioPopUp(_a) {
11
+ var items = _a.items, currentIndex = _a.currentIndex, firstName = _a.firstName, profilePic = _a.profilePic;
12
+ var _b = useState(items.at(currentIndex)), currentItem = _b[0], setCurrentItem = _b[1];
13
+ var _c = useState(currentIndex), currentIdx = _c[0], setCurrentIdx = _c[1];
14
+ var touchStartX = useRef(null);
15
+ var containerRef = useRef(null);
16
+ // const [likes, setLikes] = useState(currentItem.likes ?? 0);
17
+ // const [isLiked, setIsLiked] = useState(false);
18
+ var handleNext = function () {
19
+ var _a;
20
+ if (currentIdx < items.length - 1) {
21
+ var nextIdx = currentIdx + 1;
22
+ var nextItem = items[nextIdx];
23
+ setCurrentItem(nextItem);
24
+ setCurrentIdx(nextIdx);
25
+ // setLikes(nextItem.likes ?? 0);
26
+ // setIsLiked(false);
27
+ }
28
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
29
+ };
30
+ var handlePrev = function () {
31
+ var _a;
32
+ if (currentIdx > 0) {
33
+ var prevIdx = currentIdx - 1;
34
+ var prevItem = items[prevIdx];
35
+ setCurrentItem(prevItem);
36
+ setCurrentIdx(prevIdx);
37
+ // setLikes(prevItem.likes ?? 0);
38
+ // setIsLiked(false);
39
+ }
40
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
41
+ };
42
+ // const handleLike = () => {
43
+ // setIsLiked(!isLiked);
44
+ // setLikes(prev => isLiked ? prev - 1 : prev + 1);
45
+ // };
46
+ /** ⌨️ Keyboard navigation */
47
+ var handleKeyDown = function (e) {
48
+ if (e.key === 'ArrowRight')
49
+ handleNext();
50
+ else if (e.key === 'ArrowLeft')
51
+ handlePrev();
52
+ };
53
+ /** 📱 Touch swipe navigation */
54
+ var handleTouchStart = function (e) {
55
+ if (e.touches[0])
56
+ touchStartX.current = e.touches[0].clientX;
57
+ };
58
+ var handleTouchEnd = function (e) {
59
+ if (touchStartX.current == null || !e.changedTouches[0])
60
+ return;
61
+ var diff = touchStartX.current - e.changedTouches[0].clientX;
62
+ if (Math.abs(diff) > 50) {
63
+ // Swipe left → next, right → previous
64
+ if (diff > 0)
65
+ handleNext();
66
+ else
67
+ handlePrev();
68
+ }
69
+ touchStartX.current = null;
70
+ };
71
+ return (_jsxs("div", { ref: containerRef, tabIndex: 0, onKeyDown: handleKeyDown, onTouchStart: handleTouchStart, onTouchEnd: handleTouchEnd, className: "w-full h-full flex items-center justify-center relative rounded-lg", children: [currentIdx > 0 && (_jsx(Button, { variant: "ghost", size: "sm", onClick: handlePrev, className: "absolute -left-3 md:-left-12 z-50 text-black hover:bg-white bg-white/70 h-7 w-7 md:h-10 md:w-10 p-0 rounded-full", children: _jsx(ChevronLeft, { className: "h-8 w-8" }) })), currentIdx < items.length - 1 && (_jsx(Button, { variant: "ghost", size: "sm", onClick: handleNext, className: "absolute -right-3 md:-right-12 z-50 text-black hover:bg-white bg-white/70 h-7 w-7 md:h-10 md:w-10 p-0 rounded-full", children: _jsx(ChevronRight, { className: "h-8 w-8" }) })), _jsx("div", { className: "flex items-center justify-center w-full h-full mx-auto", children: _jsxs("div", { className: "flex flex-col md:flex-row w-full h-full rounded-lg overflow-hidden bg-white/80 backdrop-blur-sm border border-white/20 shadow-2xl", children: [_jsx("div", { className: "flex-2 flex items-center justify-center bg-black", children: currentItem.mediaType === 'video' ? (_jsx("video", { src: currentItem.url, controls: true, autoPlay: true, loop: true, className: "max-w-full max-h-full object-contain" }, currentItem._id)) : (_jsx("div", { className: "relative w-full h-full", children: _jsx(Image, { src: currentItem.url, alt: currentItem.caption, fill: true, sizes: "70vw", className: "object-contain", priority: true }, currentItem._id) })) }), _jsxs("div", { className: "flex-1 flex flex-col bg-white/90 backdrop-blur-sm text-black", children: [_jsx("div", { className: "p-4 border-b border-white/20", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "w-8 h-8 bg-gradient-to-r from-blue-500 to-purple-500 rounded-full flex items-center justify-center", children: _jsxs(Avatar, { className: "h-full w-full shadow-lg", children: [_jsx(AvatarImage, { src: profilePic }), _jsx(AvatarFallback, { children: ((firstName === null || firstName === void 0 ? void 0 : firstName[0]) || "DP") })] }) }), _jsxs("div", { children: [_jsxs("h3", { className: "font-semibold text-sm text-gray-900", children: [firstName, "'s Portfolio"] }), _jsxs("p", { className: "text-xs text-gray-500", children: [currentIdx + 1, " of ", items.length] })] })] }) }), _jsxs("div", { className: "flex-1 px-4 overflow-y-auto space-y-3", children: [_jsx("p", { className: "text-sm leading-relaxed text-gray-900", children: currentItem.caption }), currentItem.mainUrl && (_jsxs(Button, { variant: "outline", size: "sm", className: "w-full", onClick: function () { return window.open(currentItem.mainUrl, '_blank'); }, children: [_jsx(ExternalLink, { className: "w-4 h-4 mr-2" }), "View Source"] }))] }), _jsxs("div", { className: "flex flex-row justify-between border-t border-white/20 p-4 pt-2 bg-white/90 backdrop-blur-sm", children: [_jsxs("div", { className: "text-sm space-y-1", children: [_jsxs("p", { className: "font-medium text-gray-900", children: [5, " likes"] }), _jsxs("p", { className: "text-gray-600 text-xs", children: [currentItem.comments || 0, " comments \u2022 ", currentItem.shares || 0, " shares"] }), _jsx("p", { className: "text-gray-400 text-xs", children: "2 hours ago" })] }), _jsx("div", { className: "flex items-center gap-3 mb-3", children: _jsx(ShareButton, {}) })] })] })] }) })] }));
72
+ }
@@ -0,0 +1,2 @@
1
+ export default function PortfolioPage(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=temp-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temp-page.d.ts","sourceRoot":"","sources":["../../../src/main/portfolio/temp-page.tsx"],"names":[],"mappings":"AAYA,MAAM,CAAC,OAAO,UAAU,aAAa,4CAmKpC"}
@@ -0,0 +1,102 @@
1
+ // app/(dashboard)/profile/[userId]/portfolio/page.tsx
2
+ 'use client';
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
14
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
39
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
40
+ import { useEffect, useState, useRef } from 'react';
41
+ import { useParams, useRouter, useSearchParams } from 'next/navigation';
42
+ import Image from 'next/image';
43
+ import { Button } from '@myrjfa/ui/dist/misc/button';
44
+ import { ExternalLink, ChevronLeft } from 'lucide-react';
45
+ import ShareButton from '@myrjfa/ui/dist/misc/share';
46
+ import { getUserPortfolio } from '@/lib/actions';
47
+ export default function PortfolioPage() {
48
+ var _this = this;
49
+ var router = useRouter();
50
+ var id = useParams().id;
51
+ var userId = decodeURIComponent(id);
52
+ var searchParams = useSearchParams();
53
+ var firstName = searchParams.get("firstName");
54
+ var _a = useState([]), portfolio = _a[0], setPortfolio = _a[1];
55
+ var _b = useState(0), currentIndex = _b[0], setCurrentIndex = _b[1];
56
+ var containerRef = useRef(null);
57
+ useEffect(function () {
58
+ // Fetch portfolio data
59
+ // This should match your existing data fetching logic
60
+ var fetchData = function () { return __awaiter(_this, void 0, void 0, function () {
61
+ var portfolioResponse;
62
+ return __generator(this, function (_a) {
63
+ switch (_a.label) {
64
+ case 0: return [4 /*yield*/, getUserPortfolio(userId)];
65
+ case 1:
66
+ portfolioResponse = _a.sent();
67
+ if (portfolioResponse.error)
68
+ console.error(portfolioResponse.error);
69
+ else
70
+ setPortfolio(portfolioResponse.portfolios);
71
+ return [2 /*return*/];
72
+ }
73
+ });
74
+ }); };
75
+ fetchData();
76
+ var index = searchParams.get('index');
77
+ if (index) {
78
+ setCurrentIndex(parseInt(index));
79
+ }
80
+ }, [userId, searchParams]);
81
+ useEffect(function () {
82
+ // Scroll to current item
83
+ if (containerRef.current) {
84
+ var items = containerRef.current.children;
85
+ if (items[currentIndex]) {
86
+ items[currentIndex].scrollIntoView({ behavior: 'smooth', block: 'start' });
87
+ }
88
+ }
89
+ }, [currentIndex]);
90
+ var handleScroll = function () {
91
+ if (!containerRef.current)
92
+ return;
93
+ var container = containerRef.current;
94
+ var scrollPosition = container.scrollTop;
95
+ var itemHeight = window.innerHeight;
96
+ var newIndex = Math.round(scrollPosition / itemHeight);
97
+ if (newIndex !== currentIndex && newIndex >= 0 && newIndex < portfolio.length) {
98
+ setCurrentIndex(newIndex);
99
+ }
100
+ };
101
+ return (_jsxs("div", { className: "fixed inset-0 bg-black z-50 mt-15", children: [_jsx("div", { className: "absolute top-0 left-0 right-0 z-10 bg-gradient-to-b from-black/50 to-transparent", children: _jsxs("div", { className: "flex items-center justify-between p-4", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: function () { return router.back(); }, className: "text-white hover:bg-white/10", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "w-8 h-8 bg-gradient-to-r from-blue-500 to-purple-500 rounded-full flex items-center justify-center", children: _jsx("span", { className: "text-white text-xs font-bold", children: "P" }) }), _jsxs("span", { className: "text-white font-semibold", children: [firstName, "'s Portfolio"] })] }), _jsx("div", { className: "w-10" }), " "] }) }), _jsx("div", { ref: containerRef, onScroll: handleScroll, className: "h-full overflow-y-scroll snap-y snap-mandatory scrollbar-hide", style: { scrollbarWidth: 'none', msOverflowStyle: 'none' }, children: portfolio.map(function (item, index) { return (_jsxs("div", { className: "h-screen w-full snap-start snap-always relative flex flex-col", children: [_jsx("div", { className: "flex-1 flex items-center justify-center bg-black", children: item.mediaType === 'video' ? (_jsx("video", { src: item.url, controls: true, loop: true, playsInline: true, className: "max-w-full max-h-full object-contain" })) : (_jsx("div", { className: "relative w-full h-full", children: _jsx(Image, { src: item.url, alt: item.caption, fill: true, sizes: "100vw", className: "object-contain", priority: index === currentIndex }) })) }), _jsx("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 via-black/50 to-transparent p-4 pb-6", children: _jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx(ShareButton, {}), item.mainUrl && (_jsx(Button, { variant: "ghost", size: "sm", onClick: function () { return window.open(item.mainUrl, '_blank'); }, className: "text-white hover:bg-white/10", children: _jsx(ExternalLink, { className: "w-5 h-5" }) }))] }), _jsxs("div", { className: "text-white text-sm", children: [_jsx("p", { className: "font-medium", children: "5 likes" }), _jsxs("p", { className: "text-white/70 text-xs", children: [item.comments || 0, " comments \u2022 ", item.shares || 0, " shares"] })] }), _jsx("div", { className: "text-white", children: _jsxs("p", { className: "text-sm leading-relaxed line-clamp-3", children: [_jsx("span", { className: "font-semibold", children: firstName }), " ", item.caption] }) }), _jsx("div", { className: "flex gap-1 justify-center pt-2", children: portfolio.map(function (_, i) { return (_jsx("div", { className: "h-0.5 flex-1 rounded-full transition-all ".concat(i === currentIndex ? 'bg-white' : 'bg-white/30') }, i)); }) })] }) })] }, item._id)); }) }), _jsx("style", { jsx: true, children: "\n .scrollbar-hide::-webkit-scrollbar {\n display: none;\n }\n " })] }));
102
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrjfa/ui",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Shared UI components for my apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",