@burdenoff/microfe-coolandlovely 2026.716.1 → 2026.720.1
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.
- package/dist/coolandlovely/components/LookCard.d.ts +3 -1
- package/dist/coolandlovely/components/LookCard.d.ts.map +1 -1
- package/dist/coolandlovely/components/LookCard.js +80 -44
- package/dist/coolandlovely/components/LookCard.js.map +1 -1
- package/dist/coolandlovely/hooks/index.d.ts +1 -1
- package/dist/coolandlovely/hooks/index.d.ts.map +1 -1
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.d.ts +3 -0
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.d.ts.map +1 -1
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js +58 -22
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js.map +1 -1
- package/dist/coolandlovely/pages/HomePage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/HomePage.js +2 -0
- package/dist/coolandlovely/pages/HomePage.js.map +1 -1
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.js +2 -0
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.js.map +1 -1
- package/dist/coolandlovely/pages/looks/LookDetailPage.d.ts +4 -2
- package/dist/coolandlovely/pages/looks/LookDetailPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/looks/LookDetailPage.js +134 -128
- package/dist/coolandlovely/pages/looks/LookDetailPage.js.map +1 -1
- package/dist/coolandlovely/pages/looks/LooksListPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/looks/LooksListPage.js +2 -0
- package/dist/coolandlovely/pages/looks/LooksListPage.js.map +1 -1
- package/dist/coolandlovely/pages/wardrobe/WardrobeFormPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/wardrobe/WardrobeFormPage.js +46 -23
- package/dist/coolandlovely/pages/wardrobe/WardrobeFormPage.js.map +1 -1
- package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.js +70 -63
- package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.js.map +1 -1
- package/dist/coolandlovely/types/index.d.ts +11 -0
- package/dist/coolandlovely/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCoolAndLovelyApi.js","names":[],"sources":["../../../src/coolandlovely/hooks/useCoolAndLovelyApi.ts"],"sourcesContent":["/**\n * CoolAndLovely API hooks\n * @module coolandlovely/hooks\n *\n * Thin, strictly-typed React Query layer over the federated\n * `wspace-coolandlovely-svc` GraphQL contract. Every query/mutation here maps\n * 1:1 to a real `coo*` root field — no mocks. Requests go through the workspace\n * gateway via `graphqlFetch({ gateway: 'workspace', workspaceToken: true })`.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n// Imported from the `/fetch` subpath (not the barrel) so it resolves against the\n// MFE's pinned fe-libs, which exposes the helper in fetch but not yet in the\n// graphql barrel index.\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql/fetch';\n\nimport { useCoolAndLovely } from '../context';\nimport type {\n CooAddLookbookEntryInput,\n CooBrand,\n CooBrandConnection,\n CooBrandStatus,\n CooCollaboration,\n CooCollaborationStatus,\n CooCollection,\n CooCollectionStatus,\n CooCreateBrandInput,\n CooCreateCollaborationInput,\n CooCreateCollectionInput,\n CooCreateLookInput,\n CooCreateLookbookInput,\n CooCreateStyleItemInput,\n CooCreateWardrobeItemInput,\n CooLook,\n CooLookConnection,\n CooLookOccasion,\n CooLookbook,\n CooStyleCategory,\n CooStyleItem,\n CooStyleItemConnection,\n CooStyleItemStatus,\n CooStyleProfile,\n CooUpdateBrandInput,\n CooUpdateCollectionInput,\n CooUpdateLookInput,\n CooUpdateStyleItemInput,\n CooUpdateWardrobeItemInput,\n CooUpsertStyleProfileInput,\n CooWardrobeItem,\n CooWardrobeSource,\n PaginationInput,\n} from '../types';\n\n// ---------------------------------------------------------------------------\n// Query key root\n// ---------------------------------------------------------------------------\n\nconst QK = 'coolandlovely';\n\n// ---------------------------------------------------------------------------\n// Low-level fetch wrapper\n// ---------------------------------------------------------------------------\n\nconst coolQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'GraphQL request failed');\n }\n if (!response.data) {\n throw new Error('GraphQL response did not include data');\n }\n // fe-libs graphqlFetch caches every *query* response for ~15s in a global\n // response cache. After a successful mutation we drop that cache so the\n // React Query `invalidateQueries` refetch reads fresh data instead of the\n // stale pre-mutation response (otherwise a like/publish/transition/remove\n // shows no change for up to 15s).\n if (/^\\s*mutation\\b/.test(query)) {\n clearGraphqlFetchResponseCache();\n }\n return response.data;\n};\n\n// ---------------------------------------------------------------------------\n// Reusable GraphQL field selections\n// ---------------------------------------------------------------------------\n\nconst BRAND_FIELDS = `\n id workspaceId name handle tagline bio aesthetics tags websiteUrl\n isFeatured status logo { id } cover { id } createdAt updatedAt\n`;\n\nconst COLLECTION_FIELDS = `\n id workspaceId brandId name description season status tags\n cover { id } publishAt endAt createdAt updatedAt\n`;\n\nconst STYLE_ITEM_FIELDS = `\n id workspaceId brandId collectionId name description category status\n sku price currency colours sizes materials tags image { id }\n createdAt updatedAt\n`;\n\nconst LOOK_FIELDS = `\n id workspaceId authorId title caption occasion visibility isFeatured\n likeCount saveCount collaborationId image { id } tags publishedAt\n createdAt updatedAt\n`;\n\nconst LOOK_ITEM_FIELDS = `\n id workspaceId lookId styleItemId position styling createdAt updatedAt\n styleItem { id name category price currency brand { id name handle } image { id } }\n`;\n\nconst COLLABORATION_FIELDS = `\n id workspaceId brandId creatorId collectionId title brief role status\n compensation currency tags startDate endDate publishedAt createdAt updatedAt\n`;\n\nconst WARDROBE_FIELDS = `\n id workspaceId profileId name category source brandName colour size notes\n styleItemId timesWorn lastWornAt tags image { id } createdAt updatedAt\n`;\n\nconst PROFILE_FIELDS = `\n id workspaceId ownerId displayName bio visibility stylePreferences\n palette favouriteBrands sizes createdAt updatedAt\n isFollowedByMe followerCount followingCount\n`;\n\nconst LOOKBOOK_FIELDS = `\n id workspaceId ownerId profileId name description visibility tags\n cover { id } createdAt updatedAt\n`;\n\n// ===========================================================================\n// Brands\n// ===========================================================================\n\nexport interface ListBrandsArgs {\n status?: CooBrandStatus;\n featured?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useBrands = (args: ListBrandsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brands', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListBrands: CooBrandConnection }>(\n `query CooListBrands($status: CooBrandStatus, $featured: Boolean, $pagination: PaginationInput) {\n cooListBrands(status: $status, featured: $featured, pagination: $pagination) {\n items { ${BRAND_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n status: args.status,\n featured: args.featured,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListBrands;\n },\n });\n};\n\nexport const useBrand = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooBrand: CooBrand | null }>(\n `query CooBrand($id: ID!) {\n cooBrand(id: $id) {\n ${BRAND_FIELDS}\n collections { ${COLLECTION_FIELDS} }\n items { ${STYLE_ITEM_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooBrand;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateBrandInput) => {\n const data = await coolQuery<{ cooCreateBrand: CooBrand }>(\n `mutation CooCreateBrand($input: CooCreateBrandInput!) {\n cooCreateBrand(input: $input) { ${BRAND_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateBrand;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n },\n });\n};\n\nexport const useUpdateBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateBrandInput }) => {\n const data = await coolQuery<{ cooUpdateBrand: CooBrand }>(\n `mutation CooUpdateBrand($id: ID!, $input: CooUpdateBrandInput!) {\n cooUpdateBrand(id: $id, input: $input) { ${BRAND_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateBrand;\n },\n onSuccess: (brand) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand', brand.id] });\n },\n });\n};\n\nexport const useTransitionBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: CooBrandStatus }) => {\n const data = await coolQuery<{ cooTransitionBrand: CooBrand }>(\n `mutation CooTransitionBrand($id: ID!, $status: CooBrandStatus!) {\n cooTransitionBrand(id: $id, status: $status) { ${BRAND_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return data.cooTransitionBrand;\n },\n onSuccess: (brand) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand', brand.id] });\n },\n });\n};\n\nexport const useArchiveBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooArchiveBrand: boolean }>(\n `mutation CooArchiveBrand($id: ID!) { cooArchiveBrand(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooArchiveBrand;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n },\n });\n};\n\n// ===========================================================================\n// Collections\n// ===========================================================================\n\nexport interface ListCollectionsArgs {\n brandId?: string;\n status?: CooCollectionStatus;\n}\n\nexport const useCollections = (args: ListCollectionsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collections', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListCollections: CooCollection[] }>(\n `query CooListCollections($brandId: ID, $status: CooCollectionStatus) {\n cooListCollections(brandId: $brandId, status: $status) {\n ${COLLECTION_FIELDS}\n brand { id name handle }\n }\n }`,\n { brandId: args.brandId, status: args.status },\n apiGatewayUrl\n );\n return data.cooListCollections;\n },\n });\n};\n\nexport const useCollection = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collection', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooCollection: CooCollection | null }>(\n `query CooCollection($id: ID!) {\n cooCollection(id: $id) {\n ${COLLECTION_FIELDS}\n brand { id name handle }\n items { ${STYLE_ITEM_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCollection;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateCollectionInput) => {\n const data = await coolQuery<{ cooCreateCollection: CooCollection }>(\n `mutation CooCreateCollection($input: CooCreateCollectionInput!) {\n cooCreateCollection(input: $input) { ${COLLECTION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateCollection;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n },\n });\n};\n\nexport const useUpdateCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateCollectionInput }) => {\n const data = await coolQuery<{ cooUpdateCollection: CooCollection }>(\n `mutation CooUpdateCollection($id: ID!, $input: CooUpdateCollectionInput!) {\n cooUpdateCollection(id: $id, input: $input) { ${COLLECTION_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateCollection;\n },\n onSuccess: (collection) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collection', collection.id] });\n },\n });\n};\n\nexport const usePublishCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooPublishCollection: CooCollection }>(\n `mutation CooPublishCollection($id: ID!) {\n cooPublishCollection(id: $id) { ${COLLECTION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooPublishCollection;\n },\n onSuccess: (collection) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collection', collection.id] });\n },\n });\n};\n\n// ===========================================================================\n// Style Items\n// ===========================================================================\n\nexport interface ListStyleItemsArgs {\n brandId?: string;\n collectionId?: string;\n category?: CooStyleCategory;\n status?: CooStyleItemStatus;\n pagination?: PaginationInput;\n}\n\nexport const useStyleItems = (args: ListStyleItemsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'style-items', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListStyleItems: CooStyleItemConnection }>(\n `query CooListStyleItems(\n $brandId: ID, $collectionId: ID, $category: CooStyleCategory,\n $status: CooStyleItemStatus, $pagination: PaginationInput\n ) {\n cooListStyleItems(\n brandId: $brandId, collectionId: $collectionId, category: $category,\n status: $status, pagination: $pagination\n ) {\n items { ${STYLE_ITEM_FIELDS} brand { id name handle } }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n brandId: args.brandId,\n collectionId: args.collectionId,\n category: args.category,\n status: args.status,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListStyleItems;\n },\n });\n};\n\nexport const useStyleItem = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'style-item', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooStyleItem: CooStyleItem | null }>(\n `query CooStyleItem($id: ID!) {\n cooStyleItem(id: $id) {\n ${STYLE_ITEM_FIELDS}\n brand { id name handle }\n collection { id name }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooStyleItem;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateStyleItemInput) => {\n const data = await coolQuery<{ cooCreateStyleItem: CooStyleItem }>(\n `mutation CooCreateStyleItem($input: CooCreateStyleItemInput!) {\n cooCreateStyleItem(input: $input) { ${STYLE_ITEM_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateStyleItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n },\n });\n};\n\nexport const useUpdateStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateStyleItemInput }) => {\n const data = await coolQuery<{ cooUpdateStyleItem: CooStyleItem }>(\n `mutation CooUpdateStyleItem($id: ID!, $input: CooUpdateStyleItemInput!) {\n cooUpdateStyleItem(id: $id, input: $input) { ${STYLE_ITEM_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateStyleItem;\n },\n onSuccess: (item) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-item', item.id] });\n },\n });\n};\n\nexport const useArchiveStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooArchiveStyleItem: boolean }>(\n `mutation CooArchiveStyleItem($id: ID!) { cooArchiveStyleItem(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooArchiveStyleItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n },\n });\n};\n\n// ===========================================================================\n// Looks\n// ===========================================================================\n\nexport interface ListLooksArgs {\n authorId?: string;\n occasion?: CooLookOccasion;\n featured?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useLooks = (args: ListLooksArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'looks', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListLooks: CooLookConnection }>(\n `query CooListLooks(\n $authorId: ID, $occasion: CooLookOccasion, $featured: Boolean, $pagination: PaginationInput\n ) {\n cooListLooks(authorId: $authorId, occasion: $occasion, featured: $featured, pagination: $pagination) {\n items { ${LOOK_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n authorId: args.authorId,\n occasion: args.occasion,\n featured: args.featured,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListLooks;\n },\n });\n};\n\nexport const useLook = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'look', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooLook: CooLook | null }>(\n `query CooLook($id: ID!) {\n cooLook(id: $id) {\n ${LOOK_FIELDS}\n items { ${LOOK_ITEM_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLook;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useLooksWithItems = (args: ListLooksArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'looks-with-items', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListLooks: CooLookConnection }>(\n `query CooListLooksWithItems(\n $authorId: ID, $occasion: CooLookOccasion, $featured: Boolean, $pagination: PaginationInput\n ) {\n cooListLooks(authorId: $authorId, occasion: $occasion, featured: $featured, pagination: $pagination) {\n items { ${LOOK_FIELDS} items { ${LOOK_ITEM_FIELDS} } }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n authorId: args.authorId,\n occasion: args.occasion,\n featured: args.featured,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListLooks;\n },\n });\n};\n\nexport const useCreateLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateLookInput) => {\n const data = await coolQuery<{ cooCreateLook: CooLook }>(\n `mutation CooCreateLook($input: CooCreateLookInput!) {\n cooCreateLook(input: $input) { ${LOOK_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateLook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n },\n });\n};\n\nexport const useUpdateLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateLookInput }) => {\n const data = await coolQuery<{ cooUpdateLook: CooLook }>(\n `mutation CooUpdateLook($id: ID!, $input: CooUpdateLookInput!) {\n cooUpdateLook(id: $id, input: $input) { ${LOOK_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const usePublishLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooPublishLook: CooLook }>(\n `mutation CooPublishLook($id: ID!) { cooPublishLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooPublishLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useLikeLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooLikeLook: CooLook }>(\n `mutation CooLikeLook($id: ID!) { cooLikeLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLikeLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useDeleteLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooDeleteLook: boolean }>(\n `mutation CooDeleteLook($id: ID!) { cooDeleteLook(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooDeleteLook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n },\n });\n};\n\n// ===========================================================================\n// Collaborations\n// ===========================================================================\n\nexport interface ListCollaborationsArgs {\n brandId?: string;\n creatorId?: string;\n status?: CooCollaborationStatus;\n}\n\nexport const useCollaborations = (args: ListCollaborationsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collaborations', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListCollaborations: CooCollaboration[] }>(\n `query CooListCollaborations($brandId: ID, $creatorId: ID, $status: CooCollaborationStatus) {\n cooListCollaborations(brandId: $brandId, creatorId: $creatorId, status: $status) {\n ${COLLABORATION_FIELDS}\n brand { id name handle logo { id } }\n }\n }`,\n { brandId: args.brandId, creatorId: args.creatorId, status: args.status },\n apiGatewayUrl\n );\n return data.cooListCollaborations;\n },\n });\n};\n\nexport const useCollaboration = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collaboration', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooCollaboration: CooCollaboration | null }>(\n `query CooCollaboration($id: ID!) {\n cooCollaboration(id: $id) {\n ${COLLABORATION_FIELDS}\n brand { id name handle logo { id } }\n looks { ${LOOK_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCollaboration;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateCollaboration = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateCollaborationInput) => {\n const data = await coolQuery<{ cooCreateCollaboration: CooCollaboration }>(\n `mutation CooCreateCollaboration($input: CooCreateCollaborationInput!) {\n cooCreateCollaboration(input: $input) { ${COLLABORATION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateCollaboration;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaborations'] });\n },\n });\n};\n\nexport const useTransitionCollaboration = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: CooCollaborationStatus }) => {\n const data = await coolQuery<{ cooTransitionCollaboration: CooCollaboration }>(\n `mutation CooTransitionCollaboration($id: ID!, $status: CooCollaborationStatus!) {\n cooTransitionCollaboration(id: $id, status: $status) { ${COLLABORATION_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return data.cooTransitionCollaboration;\n },\n onSuccess: (collab) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaborations'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaboration', collab.id] });\n },\n });\n};\n\n// ===========================================================================\n// Wardrobe (self-scoped)\n// ===========================================================================\n\nexport interface ListWardrobeArgs {\n category?: CooStyleCategory;\n source?: CooWardrobeSource;\n}\n\nexport const useWardrobeItems = (args: ListWardrobeArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'wardrobe', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListWardrobeItems: CooWardrobeItem[] }>(\n `query CooListWardrobeItems($category: CooStyleCategory, $source: CooWardrobeSource) {\n cooListWardrobeItems(category: $category, source: $source) { ${WARDROBE_FIELDS} }\n }`,\n { category: args.category, source: args.source },\n apiGatewayUrl\n );\n return data.cooListWardrobeItems;\n },\n });\n};\n\nexport const useCreateWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateWardrobeItemInput) => {\n const data = await coolQuery<{ cooCreateWardrobeItem: CooWardrobeItem }>(\n `mutation CooCreateWardrobeItem($input: CooCreateWardrobeItemInput!) {\n cooCreateWardrobeItem(input: $input) { ${WARDROBE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useUpdateWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateWardrobeItemInput }) => {\n const data = await coolQuery<{ cooUpdateWardrobeItem: CooWardrobeItem }>(\n `mutation CooUpdateWardrobeItem($id: ID!, $input: CooUpdateWardrobeItemInput!) {\n cooUpdateWardrobeItem(id: $id, input: $input) { ${WARDROBE_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useLogWardrobeWear = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooLogWardrobeWear: CooWardrobeItem }>(\n `mutation CooLogWardrobeWear($id: ID!) {\n cooLogWardrobeWear(id: $id) { ${WARDROBE_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLogWardrobeWear;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useRemoveWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooRemoveWardrobeItem: boolean }>(\n `mutation CooRemoveWardrobeItem($id: ID!) { cooRemoveWardrobeItem(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooRemoveWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\n// ===========================================================================\n// Style Profile (self-scoped)\n// ===========================================================================\n\nexport const useMyStyleProfile = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'my-style-profile'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyStyleProfile: CooStyleProfile | null }>(\n `query CooMyStyleProfile { cooMyStyleProfile { ${PROFILE_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyStyleProfile;\n },\n });\n};\n\nexport const useUpsertStyleProfile = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooUpsertStyleProfileInput) => {\n const data = await coolQuery<{ cooUpsertStyleProfile: CooStyleProfile }>(\n `mutation CooUpsertStyleProfile($input: CooUpsertStyleProfileInput!) {\n cooUpsertStyleProfile(input: $input) { ${PROFILE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooUpsertStyleProfile;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-style-profile'] });\n },\n });\n};\n\n// ===========================================================================\n// Lookbooks\n// ===========================================================================\n\nexport const useLookbooks = (ownerId?: string) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'lookbooks', ownerId],\n queryFn: async () => {\n const data = await coolQuery<{ cooListLookbooks: CooLookbook[] }>(\n `query CooListLookbooks($ownerId: ID) {\n cooListLookbooks(ownerId: $ownerId) {\n ${LOOKBOOK_FIELDS}\n entries { id workspaceId lookbookId lookId styleItemId note position createdAt updatedAt }\n }\n }`,\n { ownerId },\n apiGatewayUrl\n );\n return data.cooListLookbooks;\n },\n });\n};\n\nexport const useCreateLookbook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateLookbookInput) => {\n const data = await coolQuery<{ cooCreateLookbook: CooLookbook }>(\n `mutation CooCreateLookbook($input: CooCreateLookbookInput!) {\n cooCreateLookbook(input: $input) { ${LOOKBOOK_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateLookbook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbooks'] });\n },\n });\n};\n\nexport const useAddLookbookEntry = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooAddLookbookEntryInput) => {\n const data = await coolQuery<{ cooAddLookbookEntry: { id: string; lookbookId: string } }>(\n `mutation CooAddLookbookEntry($input: CooAddLookbookEntryInput!) {\n cooAddLookbookEntry(input: $input) {\n id lookbookId lookId styleItemId note position createdAt updatedAt\n }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooAddLookbookEntry;\n },\n onSuccess: (entry) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbooks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbook'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbook', entry.lookbookId] });\n },\n });\n};\n\nexport const useRemoveLookbookEntry = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooRemoveLookbookEntry: boolean }>(\n `mutation CooRemoveLookbookEntry($id: ID!) { cooRemoveLookbookEntry(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooRemoveLookbookEntry;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbooks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbook'] });\n },\n });\n};\n\n// ===========================================================================\n// Follow graph (added this release — cooFollow / cooUnfollow / cooIsFollowing)\n// ===========================================================================\n\nconst FOLLOW_PROFILE_FIELDS = `\n id workspaceId ownerId displayName bio visibility\n stylePreferences palette favouriteBrands\n isFollowedByMe followerCount followingCount\n`;\n\n/** Whether the caller currently follows `followeeId`. */\nexport const useIsFollowing = (followeeId: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'is-following', followeeId],\n enabled: Boolean(followeeId),\n queryFn: async () => {\n const data = await coolQuery<{ cooIsFollowing: boolean }>(\n `query CooIsFollowing($followeeId: ID!) { cooIsFollowing(followeeId: $followeeId) }`,\n { followeeId },\n apiGatewayUrl\n );\n return data.cooIsFollowing;\n },\n });\n};\n\nexport const useFollow = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (followeeId: string) => {\n const data = await coolQuery<{ cooFollow: boolean }>(\n `mutation CooFollow($followeeId: ID!) { cooFollow(followeeId: $followeeId) }`,\n { followeeId },\n apiGatewayUrl\n );\n return data.cooFollow;\n },\n onSuccess: (_result, followeeId) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'is-following', followeeId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-following'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-followers'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-style-profile'] });\n },\n });\n};\n\nexport const useUnfollow = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (followeeId: string) => {\n const data = await coolQuery<{ cooUnfollow: boolean }>(\n `mutation CooUnfollow($followeeId: ID!) { cooUnfollow(followeeId: $followeeId) }`,\n { followeeId },\n apiGatewayUrl\n );\n return data.cooUnfollow;\n },\n onSuccess: (_result, followeeId) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'is-following', followeeId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-following'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-followers'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-style-profile'] });\n },\n });\n};\n\n/** Style profiles of people the caller follows. */\nexport const useMyFollowing = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'my-following'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyFollowing: CooStyleProfile[] }>(\n `query CooMyFollowing { cooMyFollowing { ${FOLLOW_PROFILE_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyFollowing;\n },\n });\n};\n\n/** Style profiles of people following the caller. */\nexport const useMyFollowers = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'my-followers'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyFollowers: CooStyleProfile[] }>(\n `query CooMyFollowers { cooMyFollowers { ${FOLLOW_PROFILE_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyFollowers;\n },\n });\n};\n\nexport const useLookbook = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'lookbook', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooLookbook: CooLookbook | null }>(\n `query CooLookbook($id: ID!) {\n cooLookbook(id: $id) {\n ${LOOKBOOK_FIELDS}\n entries { id workspaceId lookbookId lookId styleItemId note position createdAt updatedAt }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLookbook;\n },\n enabled: Boolean(id),\n });\n};\n"],"mappings":";;;;;;AA2DA,IAAM,IAAK,iBAML,IAAY,OAChB,GACA,GACA,MACmB;CACnB,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;EACjB,CAAC;AAEF,KAAI,EAAS,QAAQ,OACnB,OAAU,MAAM,EAAS,OAAO,IAAI,WAAW,yBAAyB;AAE1E,KAAI,CAAC,EAAS,KACZ,OAAU,MAAM,wCAAwC;AAU1D,QAHI,iBAAiB,KAAK,EAAM,IAC9B,GAAgC,EAE3B,EAAS;GAOZ,IAAe,6IAKf,IAAoB,wHAKpB,IAAoB,qKAMpB,IAAc,0KAMd,IAAmB,uKAKnB,IAAuB,+JAKvB,IAAkB,6JAKlB,IAAiB,gLAMjB,IAAkB,+GAeX,KAAa,IAAuB,EAAE,KAAK;CACtD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAU;GAAK;EAC9B,SAAS,aACM,MAAM,EACjB;;sBAEc,EAAa;;;YAI3B;GACE,QAAQ,EAAK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+
{"version":3,"file":"useCoolAndLovelyApi.js","names":[],"sources":["../../../src/coolandlovely/hooks/useCoolAndLovelyApi.ts"],"sourcesContent":["/**\n * CoolAndLovely API hooks\n * @module coolandlovely/hooks\n *\n * Thin, strictly-typed React Query layer over the federated\n * `wspace-coolandlovely-svc` GraphQL contract. Every query/mutation here maps\n * 1:1 to a real `coo*` root field — no mocks. Requests go through the workspace\n * gateway via `graphqlFetch({ gateway: 'workspace', workspaceToken: true })`.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n// Imported from the `/fetch` subpath (not the barrel) so it resolves against the\n// MFE's pinned fe-libs, which exposes the helper in fetch but not yet in the\n// graphql barrel index.\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql/fetch';\n\nimport { useCoolAndLovely } from '../context';\nimport type {\n CooAddLookbookEntryInput,\n CooBrand,\n CooBrandConnection,\n CooBrandStatus,\n CooCollaboration,\n CooCollaborationStatus,\n CooCollection,\n CooCollectionStatus,\n CooCreateBrandInput,\n CooCreateCollaborationInput,\n CooCreateCollectionInput,\n CooCreateLookInput,\n CooCreateLookbookInput,\n CooCreateStyleItemInput,\n CooCreateWardrobeItemInput,\n CooLook,\n CooLookConnection,\n CooLookOccasion,\n CooLookbook,\n CooStyleCategory,\n CooStyleItem,\n CooStyleItemConnection,\n CooStyleItemStatus,\n CooStyleProfile,\n CooUpdateBrandInput,\n CooUpdateCollectionInput,\n CooUpdateLookInput,\n CooUpdateStyleItemInput,\n CooUpdateWardrobeItemInput,\n CooUpsertStyleProfileInput,\n CooWardrobeItem,\n CooWardrobeSource,\n PaginationInput,\n} from '../types';\n\n// ---------------------------------------------------------------------------\n// Query key root\n// ---------------------------------------------------------------------------\n\nconst QK = 'coolandlovely';\n\n// ---------------------------------------------------------------------------\n// Low-level fetch wrapper\n// ---------------------------------------------------------------------------\n\nconst coolQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'GraphQL request failed');\n }\n if (!response.data) {\n throw new Error('GraphQL response did not include data');\n }\n // fe-libs graphqlFetch caches every *query* response for ~15s in a global\n // response cache. After a successful mutation we drop that cache so the\n // React Query `invalidateQueries` refetch reads fresh data instead of the\n // stale pre-mutation response (otherwise a like/publish/transition/remove\n // shows no change for up to 15s).\n if (/^\\s*mutation\\b/.test(query)) {\n clearGraphqlFetchResponseCache();\n }\n return response.data;\n};\n\n// ---------------------------------------------------------------------------\n// Reusable GraphQL field selections\n// ---------------------------------------------------------------------------\n\nconst BRAND_FIELDS = `\n id workspaceId name handle tagline bio aesthetics tags websiteUrl\n isFeatured status logo { id } cover { id } createdAt updatedAt\n`;\n\nconst COLLECTION_FIELDS = `\n id workspaceId brandId name description season status tags\n cover { id } publishAt endAt createdAt updatedAt\n`;\n\nconst STYLE_ITEM_FIELDS = `\n id workspaceId brandId collectionId name description category status\n sku price currency colours sizes materials tags image { id }\n createdAt updatedAt\n`;\n\nconst LOOK_FIELDS = `\n id workspaceId authorId title caption occasion visibility isFeatured\n likeCount saveCount collaborationId image { id } tags publishedAt\n createdAt updatedAt isLikedByMe isSavedByMe\n`;\n\nconst LOOK_ITEM_FIELDS = `\n id workspaceId lookId styleItemId position styling createdAt updatedAt\n styleItem { id name category price currency brand { id name handle } image { id } }\n`;\n\nconst COLLABORATION_FIELDS = `\n id workspaceId brandId creatorId collectionId title brief role status\n compensation currency tags startDate endDate publishedAt createdAt updatedAt\n`;\n\nconst WARDROBE_FIELDS = `\n id workspaceId profileId name category source brandName colour size notes\n styleItemId purchasePrice currency costPerWear timesWorn lastWornAt tags\n image { id } createdAt updatedAt\n`;\n\nconst PROFILE_FIELDS = `\n id workspaceId ownerId displayName bio visibility stylePreferences\n palette favouriteBrands sizes createdAt updatedAt\n isFollowedByMe followerCount followingCount\n`;\n\nconst LOOKBOOK_FIELDS = `\n id workspaceId ownerId profileId name description visibility tags\n cover { id } createdAt updatedAt\n`;\n\n// ===========================================================================\n// Brands\n// ===========================================================================\n\nexport interface ListBrandsArgs {\n status?: CooBrandStatus;\n featured?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useBrands = (args: ListBrandsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brands', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListBrands: CooBrandConnection }>(\n `query CooListBrands($status: CooBrandStatus, $featured: Boolean, $pagination: PaginationInput) {\n cooListBrands(status: $status, featured: $featured, pagination: $pagination) {\n items { ${BRAND_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n status: args.status,\n featured: args.featured,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListBrands;\n },\n });\n};\n\nexport const useBrand = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooBrand: CooBrand | null }>(\n `query CooBrand($id: ID!) {\n cooBrand(id: $id) {\n ${BRAND_FIELDS}\n collections { ${COLLECTION_FIELDS} }\n items { ${STYLE_ITEM_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooBrand;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateBrandInput) => {\n const data = await coolQuery<{ cooCreateBrand: CooBrand }>(\n `mutation CooCreateBrand($input: CooCreateBrandInput!) {\n cooCreateBrand(input: $input) { ${BRAND_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateBrand;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n },\n });\n};\n\nexport const useUpdateBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateBrandInput }) => {\n const data = await coolQuery<{ cooUpdateBrand: CooBrand }>(\n `mutation CooUpdateBrand($id: ID!, $input: CooUpdateBrandInput!) {\n cooUpdateBrand(id: $id, input: $input) { ${BRAND_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateBrand;\n },\n onSuccess: (brand) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand', brand.id] });\n },\n });\n};\n\nexport const useTransitionBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: CooBrandStatus }) => {\n const data = await coolQuery<{ cooTransitionBrand: CooBrand }>(\n `mutation CooTransitionBrand($id: ID!, $status: CooBrandStatus!) {\n cooTransitionBrand(id: $id, status: $status) { ${BRAND_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return data.cooTransitionBrand;\n },\n onSuccess: (brand) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand', brand.id] });\n },\n });\n};\n\nexport const useArchiveBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooArchiveBrand: boolean }>(\n `mutation CooArchiveBrand($id: ID!) { cooArchiveBrand(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooArchiveBrand;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n },\n });\n};\n\n// ===========================================================================\n// Collections\n// ===========================================================================\n\nexport interface ListCollectionsArgs {\n brandId?: string;\n status?: CooCollectionStatus;\n}\n\nexport const useCollections = (args: ListCollectionsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collections', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListCollections: CooCollection[] }>(\n `query CooListCollections($brandId: ID, $status: CooCollectionStatus) {\n cooListCollections(brandId: $brandId, status: $status) {\n ${COLLECTION_FIELDS}\n brand { id name handle }\n }\n }`,\n { brandId: args.brandId, status: args.status },\n apiGatewayUrl\n );\n return data.cooListCollections;\n },\n });\n};\n\nexport const useCollection = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collection', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooCollection: CooCollection | null }>(\n `query CooCollection($id: ID!) {\n cooCollection(id: $id) {\n ${COLLECTION_FIELDS}\n brand { id name handle }\n items { ${STYLE_ITEM_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCollection;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateCollectionInput) => {\n const data = await coolQuery<{ cooCreateCollection: CooCollection }>(\n `mutation CooCreateCollection($input: CooCreateCollectionInput!) {\n cooCreateCollection(input: $input) { ${COLLECTION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateCollection;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n },\n });\n};\n\nexport const useUpdateCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateCollectionInput }) => {\n const data = await coolQuery<{ cooUpdateCollection: CooCollection }>(\n `mutation CooUpdateCollection($id: ID!, $input: CooUpdateCollectionInput!) {\n cooUpdateCollection(id: $id, input: $input) { ${COLLECTION_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateCollection;\n },\n onSuccess: (collection) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collection', collection.id] });\n },\n });\n};\n\nexport const usePublishCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooPublishCollection: CooCollection }>(\n `mutation CooPublishCollection($id: ID!) {\n cooPublishCollection(id: $id) { ${COLLECTION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooPublishCollection;\n },\n onSuccess: (collection) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collection', collection.id] });\n },\n });\n};\n\n// ===========================================================================\n// Style Items\n// ===========================================================================\n\nexport interface ListStyleItemsArgs {\n brandId?: string;\n collectionId?: string;\n category?: CooStyleCategory;\n status?: CooStyleItemStatus;\n pagination?: PaginationInput;\n}\n\nexport const useStyleItems = (args: ListStyleItemsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'style-items', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListStyleItems: CooStyleItemConnection }>(\n `query CooListStyleItems(\n $brandId: ID, $collectionId: ID, $category: CooStyleCategory,\n $status: CooStyleItemStatus, $pagination: PaginationInput\n ) {\n cooListStyleItems(\n brandId: $brandId, collectionId: $collectionId, category: $category,\n status: $status, pagination: $pagination\n ) {\n items { ${STYLE_ITEM_FIELDS} brand { id name handle } }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n brandId: args.brandId,\n collectionId: args.collectionId,\n category: args.category,\n status: args.status,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListStyleItems;\n },\n });\n};\n\nexport const useStyleItem = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'style-item', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooStyleItem: CooStyleItem | null }>(\n `query CooStyleItem($id: ID!) {\n cooStyleItem(id: $id) {\n ${STYLE_ITEM_FIELDS}\n brand { id name handle }\n collection { id name }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooStyleItem;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateStyleItemInput) => {\n const data = await coolQuery<{ cooCreateStyleItem: CooStyleItem }>(\n `mutation CooCreateStyleItem($input: CooCreateStyleItemInput!) {\n cooCreateStyleItem(input: $input) { ${STYLE_ITEM_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateStyleItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n },\n });\n};\n\nexport const useUpdateStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateStyleItemInput }) => {\n const data = await coolQuery<{ cooUpdateStyleItem: CooStyleItem }>(\n `mutation CooUpdateStyleItem($id: ID!, $input: CooUpdateStyleItemInput!) {\n cooUpdateStyleItem(id: $id, input: $input) { ${STYLE_ITEM_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateStyleItem;\n },\n onSuccess: (item) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-item', item.id] });\n },\n });\n};\n\nexport const useArchiveStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooArchiveStyleItem: boolean }>(\n `mutation CooArchiveStyleItem($id: ID!) { cooArchiveStyleItem(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooArchiveStyleItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n },\n });\n};\n\n// ===========================================================================\n// Looks\n// ===========================================================================\n\nexport interface ListLooksArgs {\n authorId?: string;\n occasion?: CooLookOccasion;\n featured?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useLooks = (args: ListLooksArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'looks', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListLooks: CooLookConnection }>(\n `query CooListLooks(\n $authorId: ID, $occasion: CooLookOccasion, $featured: Boolean, $pagination: PaginationInput\n ) {\n cooListLooks(authorId: $authorId, occasion: $occasion, featured: $featured, pagination: $pagination) {\n items { ${LOOK_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n authorId: args.authorId,\n occasion: args.occasion,\n featured: args.featured,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListLooks;\n },\n });\n};\n\nexport const useLook = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'look', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooLook: CooLook | null }>(\n `query CooLook($id: ID!) {\n cooLook(id: $id) {\n ${LOOK_FIELDS}\n items { ${LOOK_ITEM_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLook;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useLooksWithItems = (args: ListLooksArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'looks-with-items', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListLooks: CooLookConnection }>(\n `query CooListLooksWithItems(\n $authorId: ID, $occasion: CooLookOccasion, $featured: Boolean, $pagination: PaginationInput\n ) {\n cooListLooks(authorId: $authorId, occasion: $occasion, featured: $featured, pagination: $pagination) {\n items { ${LOOK_FIELDS} items { ${LOOK_ITEM_FIELDS} } }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n authorId: args.authorId,\n occasion: args.occasion,\n featured: args.featured,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListLooks;\n },\n });\n};\n\nexport const useCreateLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateLookInput) => {\n const data = await coolQuery<{ cooCreateLook: CooLook }>(\n `mutation CooCreateLook($input: CooCreateLookInput!) {\n cooCreateLook(input: $input) { ${LOOK_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateLook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n },\n });\n};\n\nexport const useUpdateLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateLookInput }) => {\n const data = await coolQuery<{ cooUpdateLook: CooLook }>(\n `mutation CooUpdateLook($id: ID!, $input: CooUpdateLookInput!) {\n cooUpdateLook(id: $id, input: $input) { ${LOOK_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const usePublishLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooPublishLook: CooLook }>(\n `mutation CooPublishLook($id: ID!) { cooPublishLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooPublishLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useLikeLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooLikeLook: CooLook }>(\n `mutation CooLikeLook($id: ID!) { cooLikeLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLikeLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useUnlikeLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooUnlikeLook: CooLook }>(\n `mutation CooUnlikeLook($id: ID!) { cooUnlikeLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooUnlikeLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useSaveLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooSaveLook: CooLook }>(\n `mutation CooSaveLook($id: ID!) { cooSaveLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooSaveLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useUnsaveLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooUnsaveLook: CooLook }>(\n `mutation CooUnsaveLook($id: ID!) { cooUnsaveLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooUnsaveLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useDeleteLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooDeleteLook: boolean }>(\n `mutation CooDeleteLook($id: ID!) { cooDeleteLook(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooDeleteLook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks-with-items'] });\n },\n });\n};\n\n// ===========================================================================\n// Collaborations\n// ===========================================================================\n\nexport interface ListCollaborationsArgs {\n brandId?: string;\n creatorId?: string;\n status?: CooCollaborationStatus;\n}\n\nexport const useCollaborations = (args: ListCollaborationsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collaborations', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListCollaborations: CooCollaboration[] }>(\n `query CooListCollaborations($brandId: ID, $creatorId: ID, $status: CooCollaborationStatus) {\n cooListCollaborations(brandId: $brandId, creatorId: $creatorId, status: $status) {\n ${COLLABORATION_FIELDS}\n brand { id name handle logo { id } }\n }\n }`,\n { brandId: args.brandId, creatorId: args.creatorId, status: args.status },\n apiGatewayUrl\n );\n return data.cooListCollaborations;\n },\n });\n};\n\nexport const useCollaboration = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collaboration', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooCollaboration: CooCollaboration | null }>(\n `query CooCollaboration($id: ID!) {\n cooCollaboration(id: $id) {\n ${COLLABORATION_FIELDS}\n brand { id name handle logo { id } }\n looks { ${LOOK_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCollaboration;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateCollaboration = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateCollaborationInput) => {\n const data = await coolQuery<{ cooCreateCollaboration: CooCollaboration }>(\n `mutation CooCreateCollaboration($input: CooCreateCollaborationInput!) {\n cooCreateCollaboration(input: $input) { ${COLLABORATION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateCollaboration;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaborations'] });\n },\n });\n};\n\nexport const useTransitionCollaboration = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: CooCollaborationStatus }) => {\n const data = await coolQuery<{ cooTransitionCollaboration: CooCollaboration }>(\n `mutation CooTransitionCollaboration($id: ID!, $status: CooCollaborationStatus!) {\n cooTransitionCollaboration(id: $id, status: $status) { ${COLLABORATION_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return data.cooTransitionCollaboration;\n },\n onSuccess: (collab) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaborations'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaboration', collab.id] });\n },\n });\n};\n\n// ===========================================================================\n// Wardrobe (self-scoped)\n// ===========================================================================\n\nexport interface ListWardrobeArgs {\n category?: CooStyleCategory;\n source?: CooWardrobeSource;\n}\n\nexport const useWardrobeItems = (args: ListWardrobeArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'wardrobe', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListWardrobeItems: CooWardrobeItem[] }>(\n `query CooListWardrobeItems($category: CooStyleCategory, $source: CooWardrobeSource) {\n cooListWardrobeItems(category: $category, source: $source) { ${WARDROBE_FIELDS} }\n }`,\n { category: args.category, source: args.source },\n apiGatewayUrl\n );\n return data.cooListWardrobeItems;\n },\n });\n};\n\nexport const useCreateWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateWardrobeItemInput) => {\n const data = await coolQuery<{ cooCreateWardrobeItem: CooWardrobeItem }>(\n `mutation CooCreateWardrobeItem($input: CooCreateWardrobeItemInput!) {\n cooCreateWardrobeItem(input: $input) { ${WARDROBE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useUpdateWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateWardrobeItemInput }) => {\n const data = await coolQuery<{ cooUpdateWardrobeItem: CooWardrobeItem }>(\n `mutation CooUpdateWardrobeItem($id: ID!, $input: CooUpdateWardrobeItemInput!) {\n cooUpdateWardrobeItem(id: $id, input: $input) { ${WARDROBE_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useLogWardrobeWear = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooLogWardrobeWear: CooWardrobeItem }>(\n `mutation CooLogWardrobeWear($id: ID!) {\n cooLogWardrobeWear(id: $id) { ${WARDROBE_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLogWardrobeWear;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useRemoveWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooRemoveWardrobeItem: boolean }>(\n `mutation CooRemoveWardrobeItem($id: ID!) { cooRemoveWardrobeItem(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooRemoveWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\n// ===========================================================================\n// Style Profile (self-scoped)\n// ===========================================================================\n\nexport const useMyStyleProfile = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'my-style-profile'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyStyleProfile: CooStyleProfile | null }>(\n `query CooMyStyleProfile { cooMyStyleProfile { ${PROFILE_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyStyleProfile;\n },\n });\n};\n\nexport const useUpsertStyleProfile = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooUpsertStyleProfileInput) => {\n const data = await coolQuery<{ cooUpsertStyleProfile: CooStyleProfile }>(\n `mutation CooUpsertStyleProfile($input: CooUpsertStyleProfileInput!) {\n cooUpsertStyleProfile(input: $input) { ${PROFILE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooUpsertStyleProfile;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-style-profile'] });\n },\n });\n};\n\n// ===========================================================================\n// Lookbooks\n// ===========================================================================\n\nexport const useLookbooks = (ownerId?: string) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'lookbooks', ownerId],\n queryFn: async () => {\n const data = await coolQuery<{ cooListLookbooks: CooLookbook[] }>(\n `query CooListLookbooks($ownerId: ID) {\n cooListLookbooks(ownerId: $ownerId) {\n ${LOOKBOOK_FIELDS}\n entries { id workspaceId lookbookId lookId styleItemId note position createdAt updatedAt }\n }\n }`,\n { ownerId },\n apiGatewayUrl\n );\n return data.cooListLookbooks;\n },\n });\n};\n\nexport const useCreateLookbook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateLookbookInput) => {\n const data = await coolQuery<{ cooCreateLookbook: CooLookbook }>(\n `mutation CooCreateLookbook($input: CooCreateLookbookInput!) {\n cooCreateLookbook(input: $input) { ${LOOKBOOK_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateLookbook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbooks'] });\n },\n });\n};\n\nexport const useAddLookbookEntry = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooAddLookbookEntryInput) => {\n const data = await coolQuery<{ cooAddLookbookEntry: { id: string; lookbookId: string } }>(\n `mutation CooAddLookbookEntry($input: CooAddLookbookEntryInput!) {\n cooAddLookbookEntry(input: $input) {\n id lookbookId lookId styleItemId note position createdAt updatedAt\n }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooAddLookbookEntry;\n },\n onSuccess: (entry) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbooks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbook'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbook', entry.lookbookId] });\n },\n });\n};\n\nexport const useRemoveLookbookEntry = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooRemoveLookbookEntry: boolean }>(\n `mutation CooRemoveLookbookEntry($id: ID!) { cooRemoveLookbookEntry(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooRemoveLookbookEntry;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbooks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbook'] });\n },\n });\n};\n\n// ===========================================================================\n// Follow graph (added this release — cooFollow / cooUnfollow / cooIsFollowing)\n// ===========================================================================\n\nconst FOLLOW_PROFILE_FIELDS = `\n id workspaceId ownerId displayName bio visibility\n stylePreferences palette favouriteBrands\n isFollowedByMe followerCount followingCount\n`;\n\n/** Whether the caller currently follows `followeeId`. */\nexport const useIsFollowing = (followeeId: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'is-following', followeeId],\n enabled: Boolean(followeeId),\n queryFn: async () => {\n const data = await coolQuery<{ cooIsFollowing: boolean }>(\n `query CooIsFollowing($followeeId: ID!) { cooIsFollowing(followeeId: $followeeId) }`,\n { followeeId },\n apiGatewayUrl\n );\n return data.cooIsFollowing;\n },\n });\n};\n\nexport const useFollow = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (followeeId: string) => {\n const data = await coolQuery<{ cooFollow: boolean }>(\n `mutation CooFollow($followeeId: ID!) { cooFollow(followeeId: $followeeId) }`,\n { followeeId },\n apiGatewayUrl\n );\n return data.cooFollow;\n },\n onSuccess: (_result, followeeId) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'is-following', followeeId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-following'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-followers'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-style-profile'] });\n },\n });\n};\n\nexport const useUnfollow = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (followeeId: string) => {\n const data = await coolQuery<{ cooUnfollow: boolean }>(\n `mutation CooUnfollow($followeeId: ID!) { cooUnfollow(followeeId: $followeeId) }`,\n { followeeId },\n apiGatewayUrl\n );\n return data.cooUnfollow;\n },\n onSuccess: (_result, followeeId) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'is-following', followeeId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-following'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-followers'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-style-profile'] });\n },\n });\n};\n\n/** Style profiles of people the caller follows. */\nexport const useMyFollowing = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'my-following'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyFollowing: CooStyleProfile[] }>(\n `query CooMyFollowing { cooMyFollowing { ${FOLLOW_PROFILE_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyFollowing;\n },\n });\n};\n\n/** Style profiles of people following the caller. */\nexport const useMyFollowers = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'my-followers'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyFollowers: CooStyleProfile[] }>(\n `query CooMyFollowers { cooMyFollowers { ${FOLLOW_PROFILE_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyFollowers;\n },\n });\n};\n\nexport const useLookbook = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'lookbook', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooLookbook: CooLookbook | null }>(\n `query CooLookbook($id: ID!) {\n cooLookbook(id: $id) {\n ${LOOKBOOK_FIELDS}\n entries { id workspaceId lookbookId lookId styleItemId note position createdAt updatedAt }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLookbook;\n },\n enabled: Boolean(id),\n });\n};\n"],"mappings":";;;;;;AA2DA,IAAM,IAAK,iBAML,IAAY,OAChB,GACA,GACA,MACmB;CACnB,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;EACjB,CAAC;AAEF,KAAI,EAAS,QAAQ,OACnB,OAAU,MAAM,EAAS,OAAO,IAAI,WAAW,yBAAyB;AAE1E,KAAI,CAAC,EAAS,KACZ,OAAU,MAAM,wCAAwC;AAU1D,QAHI,iBAAiB,KAAK,EAAM,IAC9B,GAAgC,EAE3B,EAAS;GAOZ,IAAe,6IAKf,IAAoB,wHAKpB,IAAoB,qKAMpB,IAAc,kMAMd,IAAmB,uKAKnB,IAAuB,+JAKvB,IAAkB,mMAMlB,IAAiB,gLAMjB,IAAkB,+GAeX,KAAa,IAAuB,EAAE,KAAK;CACtD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAU;GAAK;EAC9B,SAAS,aACM,MAAM,EACjB;;sBAEc,EAAa;;;YAI3B;GACE,QAAQ,EAAK;GACb,UAAU,EAAK;GACf,YAAY,EAAK,cAAc;IAAE,OAAO;IAAI,QAAQ;IAAG;GACxD,EACD,EACD,EACW;EAEf,CAAC;GAGS,KAAY,MAA2B;CAClD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAS;GAAG;EAC3B,SAAS,aACM,MAAM,EACjB;;cAEM,EAAa;4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UAAU,CAAC,GAAI,eAAe,EAAE,CAAC,EACjE,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,mBAAmB,EAAE,CAAC;;EAE7E,CAAC;GAGS,WAAoB;CAC/B,IAAM,IAAc,GAAgB,EAC9B,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB,mFACA,EAAE,eAAY,EACd,EACD,EACW;EAEd,YAAY,GAAS,MAAe;AAI7B,GAHA,EAAY,kBAAkB,EAAE,UAAU;IAAC;IAAI;IAAgB;IAAW,EAAE,CAAC,EAC7E,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,eAAe,EAAE,CAAC,EACjE,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,eAAe,EAAE,CAAC,EACjE,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,mBAAmB,EAAE,CAAC;;EAE7E,CAAC;GAIS,WAAuB;CAClC,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU,CAAC,GAAI,eAAe;EAC9B,SAAS,aACM,MAAM,EACjB,2CAA2C,GAAsB,OACjE,EAAE,EACF,EACD,EACW;EAEf,CAAC;GAmBS,MAAe,MAA2B;CACrD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAY;GAAG;EAC9B,SAAS,aACM,MAAM,EACjB;;cAEM,EAAgB;;;YAItB,EAAE,OAAI,EACN,EACD,EACW;EAEd,SAAS,EAAQ;EAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/pages/HomePage.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAsJH,wBAAgB,QAAQ,
|
|
1
|
+
{"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/pages/HomePage.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAsJH,wBAAgB,QAAQ,gCAgRvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomePage.js","names":[],"sources":["../../../src/coolandlovely/pages/HomePage.tsx"],"sourcesContent":["/**\n * Overview / Home Page\n * @module coolandlovely/pages\n *\n * The CoolAndLovely command center landing page: a style-operating-system\n * dashboard rolling up live catalog (brands, items), social (looks,\n * collaborations) and the shopper's own wardrobe — all from real `coo*` ops.\n */\n\nimport { useMemo } from 'react';\nimport {\n Store,\n Shirt,\n Sparkles,\n Handshake,\n Shapes,\n Heart,\n ArrowRight,\n Star,\n Plus,\n BookHeart,\n UserCircle,\n Compass,\n TrendingUp,\n} from 'lucide-react';\nimport { EmphasisPanel, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../components/PageLayout';\nimport { MetricsCard } from '../components/MetricsCard';\nimport { StatusBadge } from '../components/StatusBadge';\nimport { LoadingView, ErrorView } from '../components/StateViews';\nimport { Thumbnail } from '../components/Thumbnail';\nimport { LookCard } from '../components/LookCard';\nimport { useCoolAndLovely } from '../context/CoolAndLovelyContext';\nimport { useBrands, useStyleItems, useLooks, useCollaborations, useWardrobeItems } from '../hooks';\nimport { cn } from '../utils/cn';\nimport type { DashboardStats } from '../types';\n\n/** Time-of-day greeting for the dashboard title (local clock, honest — no data). */\nfunction greeting(): string {\n const hour = new Date().getHours();\n if (hour < 12) return 'Good morning';\n if (hour < 18) return 'Good afternoon';\n return 'Good evening';\n}\n\ninterface QuickAction {\n label: string;\n description: string;\n icon: React.ReactNode;\n path: string;\n color: string;\n}\n\nconst quickActions: QuickAction[] = [\n {\n label: 'New Brand',\n description: 'Launch a storefront',\n icon: <Store className=\"h-5 w-5\" />,\n path: '/brands/new',\n color: 'bg-accent-purple-subtle text-text-primary',\n },\n {\n label: 'Add Style Item',\n description: 'List a piece',\n icon: <Shirt className=\"h-5 w-5\" />,\n path: '/items/new',\n color: 'bg-[var(--color-accent-soft)] text-text-primary',\n },\n {\n label: 'Publish a Look',\n description: 'Shop-the-look outfit',\n icon: <Sparkles className=\"h-5 w-5\" />,\n path: '/looks/new',\n color: 'bg-status-success-bg-subtle text-status-success-text',\n },\n {\n label: 'My Wardrobe',\n description: 'What you own',\n icon: <Heart className=\"h-5 w-5\" />,\n path: '/wardrobe',\n color: 'bg-status-warning-bg-subtle text-status-warning-text',\n },\n];\n\nconst modules = [\n {\n label: 'Brands',\n description: 'Storefronts with a publish lifecycle',\n icon: <Store className=\"h-6 w-6\" />,\n path: '/brands',\n color: 'bg-accent-purple-subtle text-text-primary',\n },\n {\n label: 'Collections',\n description: 'Seasonal drops & curated edits',\n icon: <Shapes className=\"h-6 w-6\" />,\n path: '/collections',\n color: 'bg-accent-blue-subtle text-accent-blue',\n },\n {\n label: 'Style Items',\n description: 'The shoppable catalogue',\n icon: <Shirt className=\"h-6 w-6\" />,\n path: '/items',\n color: 'bg-[var(--color-accent-soft)] text-text-primary',\n },\n {\n label: 'Looks',\n description: 'Published shop-the-look outfits',\n icon: <Sparkles className=\"h-6 w-6\" />,\n path: '/looks',\n color: 'bg-status-success-bg-subtle text-status-success-text',\n },\n {\n label: 'Collaborations',\n description: 'Brand × creator partnerships',\n icon: <Handshake className=\"h-6 w-6\" />,\n path: '/collaborations',\n color: 'bg-status-warning-bg-subtle text-status-warning-text',\n },\n {\n label: 'Wardrobe',\n description: 'Your digital closet & wear log',\n icon: <Heart className=\"h-6 w-6\" />,\n path: '/wardrobe',\n color: 'bg-status-error-bg-subtle text-status-error-text',\n },\n {\n label: 'Lookbooks',\n description: 'Themed boards of saved pieces',\n icon: <BookHeart className=\"h-6 w-6\" />,\n path: '/lookbooks',\n color: 'bg-accent-purple-subtle text-text-primary',\n },\n {\n label: 'Style Profile',\n description: 'Your taste, palette & sizing',\n icon: <UserCircle className=\"h-6 w-6\" />,\n path: '/profile',\n color: 'bg-accent-blue-subtle text-accent-blue',\n },\n {\n label: 'Discover',\n description: 'A feed tuned to your taste',\n icon: <Compass className=\"h-6 w-6\" />,\n path: '/discover',\n color: 'bg-[var(--color-accent-soft)] text-text-primary',\n },\n {\n label: 'Trends',\n description: 'Live signals from platform activity',\n icon: <TrendingUp className=\"h-6 w-6\" />,\n path: '/trends',\n color: 'bg-status-success-bg-subtle text-status-success-text',\n },\n];\n\nexport function HomePage() {\n const { navigateTo, currentUser } = useCoolAndLovely();\n\n const brands = useBrands();\n const items = useStyleItems();\n const looks = useLooks();\n const collaborations = useCollaborations();\n const wardrobe = useWardrobeItems();\n\n const firstName = currentUser?.firstName ?? currentUser?.name ?? 'there';\n\n const isLoading =\n brands.isLoading ||\n items.isLoading ||\n looks.isLoading ||\n collaborations.isLoading ||\n wardrobe.isLoading;\n\n const isError = brands.isError && items.isError && looks.isError && collaborations.isError;\n\n const stats = useMemo<DashboardStats>(() => {\n const brandItems = brands.data?.items ?? [];\n const styleItems = items.data?.items ?? [];\n const lookItems = looks.data?.items ?? [];\n const collabs = collaborations.data ?? [];\n const wardrobeItems = wardrobe.data ?? [];\n return {\n totalBrands: brandItems.length,\n publishedBrands: brandItems.filter((b) => b.status === 'PUBLISHED').length,\n totalStyleItems: styleItems.length,\n activeStyleItems: styleItems.filter((i) => i.status === 'ACTIVE').length,\n totalLooks: lookItems.length,\n featuredLooks: lookItems.filter((l) => l.isFeatured).length,\n activeCollaborations: collabs.filter(\n (c) => c.status === 'ACCEPTED' || c.status === 'IN_PROGRESS'\n ).length,\n wardrobeItems: wardrobeItems.length,\n };\n }, [brands.data, items.data, looks.data, collaborations.data, wardrobe.data]);\n\n const latestLooks = useMemo(() => [...(looks.data?.items ?? [])].slice(0, 5), [looks.data]);\n\n const recentBrands = useMemo(\n () =>\n [...(brands.data?.items ?? [])]\n .sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime())\n .slice(0, 4),\n [brands.data]\n );\n\n if (isLoading) {\n return (\n <PageLayout title=\"CoolAndLovely\">\n <LoadingView label=\"Loading your style command center…\" />\n </PageLayout>\n );\n }\n\n if (isError) {\n return (\n <PageLayout title=\"CoolAndLovely\">\n <ErrorView\n title=\"Could not load CoolAndLovely\"\n message=\"The fashion service did not respond. Please try again.\"\n onRetry={() => {\n void brands.refetch();\n void items.refetch();\n void looks.refetch();\n void collaborations.refetch();\n void wardrobe.refetch();\n }}\n />\n </PageLayout>\n );\n }\n\n const metrics = [\n {\n icon: <Store className=\"h-5 w-5\" />,\n value: stats.totalBrands.toString(),\n label: 'Brands',\n sub: `${stats.publishedBrands} published`,\n },\n {\n icon: <Shirt className=\"h-5 w-5\" />,\n value: stats.totalStyleItems.toString(),\n label: 'Style Items',\n sub: `${stats.activeStyleItems} active`,\n },\n {\n icon: <Sparkles className=\"h-5 w-5\" />,\n value: stats.totalLooks.toString(),\n label: 'Looks',\n sub: `${stats.featuredLooks} featured`,\n },\n {\n icon: <Handshake className=\"h-5 w-5\" />,\n value: stats.activeCollaborations.toString(),\n label: 'Active Collabs',\n sub: `${stats.wardrobeItems} in wardrobe`,\n },\n ];\n\n return (\n <PageLayout\n title={`${greeting()}, ${firstName}`}\n description=\"Your fashion & lifestyle command center\"\n hero\n >\n <PagePurpose className=\"mb-6\">\n CoolAndLovely connects the three sides of style on one workspace-native model: brands launch\n storefronts and seasonal collections, you build a wardrobe and lookbooks, and creators\n publish shop-the-look outfits and run brand collaborations. Jump into any module below — all\n data is live from the CoolAndLovely service.\n </PagePurpose>\n\n {/* Headline metrics — the one emphasis zone for this page */}\n <EmphasisPanel className=\"mb-8\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">At a glance</h2>\n <div className=\"grid grid-cols-2 gap-4 lg:grid-cols-4\">\n {metrics.map((m, index) => (\n <MetricsCard\n key={m.label}\n icon={m.icon}\n value={m.value}\n label={m.label}\n trendValue={m.sub}\n trend=\"neutral\"\n featured={index === 0}\n />\n ))}\n </div>\n </EmphasisPanel>\n\n {/* Quick Actions */}\n <section className=\"mb-8\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">Quick actions</h2>\n <div className=\"grid grid-cols-2 gap-4 lg:grid-cols-4\">\n {quickActions.map((action) => (\n <button\n key={action.label}\n type=\"button\"\n onClick={() => navigateTo(action.path)}\n className={cn(\n 'flex items-start gap-3 rounded-lg border border-border-seam bg-bg-surface p-4 text-left shadow-sm transition-all',\n 'hover:border-accent-foreground/20 hover:shadow-md'\n )}\n >\n <div\n className={cn(\n 'flex h-10 w-10 shrink-0 items-center justify-center rounded-lg',\n action.color\n )}\n >\n {action.icon}\n </div>\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold text-text-primary\">{action.label}</p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">{action.description}</p>\n </div>\n <Plus className=\"mt-1 h-4 w-4 shrink-0 text-text-secondary\" />\n </button>\n ))}\n </div>\n </section>\n\n {/* Modules */}\n <section className=\"mb-8\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">Explore</h2>\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4\">\n {modules.map((mod) => (\n <button\n key={mod.label}\n type=\"button\"\n onClick={() => navigateTo(mod.path)}\n className=\"flex flex-col gap-3 rounded-lg border border-border-seam bg-bg-surface p-5 text-left transition-all hover:border-accent-foreground/20 hover:shadow-md\"\n >\n <div\n className={cn('flex h-12 w-12 items-center justify-center rounded-full', mod.color)}\n >\n {mod.icon}\n </div>\n <div>\n <p className=\"text-sm font-semibold text-text-primary\">{mod.label}</p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">{mod.description}</p>\n </div>\n </button>\n ))}\n </div>\n </section>\n\n {/* Latest looks */}\n <section className=\"mb-8\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Latest looks</h2>\n <button\n type=\"button\"\n onClick={() => navigateTo('/looks')}\n className=\"flex items-center gap-1 text-sm font-medium text-primary hover:underline\"\n >\n View all <ArrowRight className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n {latestLooks.length === 0 ? (\n <p className=\"rounded-lg border border-border-seam bg-bg-surface p-6 text-sm text-text-secondary\">\n No looks published yet. Be the first to publish a shop-the-look outfit.\n </p>\n ) : (\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-5\">\n {latestLooks.map((look) => (\n <LookCard\n key={look.id}\n id={look.id}\n title={look.title}\n occasion={look.occasion}\n imageFileId={look.image?.id}\n likeCount={look.likeCount}\n onOpen={() => navigateTo(`/looks/${look.id}`)}\n showActions\n />\n ))}\n </div>\n )}\n </section>\n\n {/* Recent brands */}\n {recentBrands.length > 0 && (\n <section>\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Recently updated brands</h2>\n <button\n type=\"button\"\n onClick={() => navigateTo('/brands')}\n className=\"flex items-center gap-1 text-sm font-medium text-primary hover:underline\"\n >\n View all <ArrowRight className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n {recentBrands.map((brand) => (\n <button\n key={brand.id}\n type=\"button\"\n onClick={() => navigateTo(`/brands/${brand.id}`)}\n className=\"group flex items-center gap-3 rounded-xl border border-border-seam bg-bg-surface p-3 text-left shadow-sm transition-all hover:border-accent-foreground/20 hover:shadow-md\"\n >\n <Thumbnail\n icon={<Store className=\"h-5 w-5\" />}\n seed={brand.id}\n fileId={brand.logo?.id ?? brand.cover?.id}\n alt={brand.name}\n className=\"h-11 w-11 shrink-0 rounded-full ring-2 ring-bg-surface\"\n />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-1.5\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{brand.name}</p>\n {brand.isFeatured && (\n <Star className=\"h-3.5 w-3.5 shrink-0 fill-status-warning-text text-status-warning-text\" />\n )}\n </div>\n <p className=\"truncate text-xs text-text-secondary\">@{brand.handle}</p>\n </div>\n <StatusBadge status={brand.status} />\n </button>\n ))}\n </div>\n </section>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OACN,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAa,KAAK,MACjB,kBAAC,UAAD;KAEE,MAAK;KACL,eAAe,EAAW,WAAW,EAAM,KAAK;KAChD,WAAU;eAJZ;MAME,kBAAC,GAAD;OACE,MAAM,kBAAC,GAAD,EAAO,WAAU,WAAY,CAAA;OACnC,MAAM,EAAM;OACZ,QAAQ,EAAM,MAAM,MAAM,EAAM,OAAO;OACvC,KAAK,EAAM;OACX,WAAU;OACV,CAAA;MACF,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBAAkD,EAAM;SAAS,CAAA,EAC7E,EAAM,cACL,kBAAC,GAAD,EAAM,WAAU,0EAA2E,CAAA,CAEzF;WACN,kBAAC,KAAD;QAAG,WAAU;kBAAb,CAAoD,KAAE,EAAM,OAAW;UACnE;;MACN,kBAAC,GAAD,EAAa,QAAQ,EAAM,QAAU,CAAA;MAC9B;OAtBF,EAAM,GAsBJ,CACT;IACE,CAAA,CACE,EAAA,CAAA;GAED"}
|
|
1
|
+
{"version":3,"file":"HomePage.js","names":[],"sources":["../../../src/coolandlovely/pages/HomePage.tsx"],"sourcesContent":["/**\n * Overview / Home Page\n * @module coolandlovely/pages\n *\n * The CoolAndLovely command center landing page: a style-operating-system\n * dashboard rolling up live catalog (brands, items), social (looks,\n * collaborations) and the shopper's own wardrobe — all from real `coo*` ops.\n */\n\nimport { useMemo } from 'react';\nimport {\n Store,\n Shirt,\n Sparkles,\n Handshake,\n Shapes,\n Heart,\n ArrowRight,\n Star,\n Plus,\n BookHeart,\n UserCircle,\n Compass,\n TrendingUp,\n} from 'lucide-react';\nimport { EmphasisPanel, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../components/PageLayout';\nimport { MetricsCard } from '../components/MetricsCard';\nimport { StatusBadge } from '../components/StatusBadge';\nimport { LoadingView, ErrorView } from '../components/StateViews';\nimport { Thumbnail } from '../components/Thumbnail';\nimport { LookCard } from '../components/LookCard';\nimport { useCoolAndLovely } from '../context/CoolAndLovelyContext';\nimport { useBrands, useStyleItems, useLooks, useCollaborations, useWardrobeItems } from '../hooks';\nimport { cn } from '../utils/cn';\nimport type { DashboardStats } from '../types';\n\n/** Time-of-day greeting for the dashboard title (local clock, honest — no data). */\nfunction greeting(): string {\n const hour = new Date().getHours();\n if (hour < 12) return 'Good morning';\n if (hour < 18) return 'Good afternoon';\n return 'Good evening';\n}\n\ninterface QuickAction {\n label: string;\n description: string;\n icon: React.ReactNode;\n path: string;\n color: string;\n}\n\nconst quickActions: QuickAction[] = [\n {\n label: 'New Brand',\n description: 'Launch a storefront',\n icon: <Store className=\"h-5 w-5\" />,\n path: '/brands/new',\n color: 'bg-accent-purple-subtle text-text-primary',\n },\n {\n label: 'Add Style Item',\n description: 'List a piece',\n icon: <Shirt className=\"h-5 w-5\" />,\n path: '/items/new',\n color: 'bg-[var(--color-accent-soft)] text-text-primary',\n },\n {\n label: 'Publish a Look',\n description: 'Shop-the-look outfit',\n icon: <Sparkles className=\"h-5 w-5\" />,\n path: '/looks/new',\n color: 'bg-status-success-bg-subtle text-status-success-text',\n },\n {\n label: 'My Wardrobe',\n description: 'What you own',\n icon: <Heart className=\"h-5 w-5\" />,\n path: '/wardrobe',\n color: 'bg-status-warning-bg-subtle text-status-warning-text',\n },\n];\n\nconst modules = [\n {\n label: 'Brands',\n description: 'Storefronts with a publish lifecycle',\n icon: <Store className=\"h-6 w-6\" />,\n path: '/brands',\n color: 'bg-accent-purple-subtle text-text-primary',\n },\n {\n label: 'Collections',\n description: 'Seasonal drops & curated edits',\n icon: <Shapes className=\"h-6 w-6\" />,\n path: '/collections',\n color: 'bg-accent-blue-subtle text-accent-blue',\n },\n {\n label: 'Style Items',\n description: 'The shoppable catalogue',\n icon: <Shirt className=\"h-6 w-6\" />,\n path: '/items',\n color: 'bg-[var(--color-accent-soft)] text-text-primary',\n },\n {\n label: 'Looks',\n description: 'Published shop-the-look outfits',\n icon: <Sparkles className=\"h-6 w-6\" />,\n path: '/looks',\n color: 'bg-status-success-bg-subtle text-status-success-text',\n },\n {\n label: 'Collaborations',\n description: 'Brand × creator partnerships',\n icon: <Handshake className=\"h-6 w-6\" />,\n path: '/collaborations',\n color: 'bg-status-warning-bg-subtle text-status-warning-text',\n },\n {\n label: 'Wardrobe',\n description: 'Your digital closet & wear log',\n icon: <Heart className=\"h-6 w-6\" />,\n path: '/wardrobe',\n color: 'bg-status-error-bg-subtle text-status-error-text',\n },\n {\n label: 'Lookbooks',\n description: 'Themed boards of saved pieces',\n icon: <BookHeart className=\"h-6 w-6\" />,\n path: '/lookbooks',\n color: 'bg-accent-purple-subtle text-text-primary',\n },\n {\n label: 'Style Profile',\n description: 'Your taste, palette & sizing',\n icon: <UserCircle className=\"h-6 w-6\" />,\n path: '/profile',\n color: 'bg-accent-blue-subtle text-accent-blue',\n },\n {\n label: 'Discover',\n description: 'A feed tuned to your taste',\n icon: <Compass className=\"h-6 w-6\" />,\n path: '/discover',\n color: 'bg-[var(--color-accent-soft)] text-text-primary',\n },\n {\n label: 'Trends',\n description: 'Live signals from platform activity',\n icon: <TrendingUp className=\"h-6 w-6\" />,\n path: '/trends',\n color: 'bg-status-success-bg-subtle text-status-success-text',\n },\n];\n\nexport function HomePage() {\n const { navigateTo, currentUser } = useCoolAndLovely();\n\n const brands = useBrands();\n const items = useStyleItems();\n const looks = useLooks();\n const collaborations = useCollaborations();\n const wardrobe = useWardrobeItems();\n\n const firstName = currentUser?.firstName ?? currentUser?.name ?? 'there';\n\n const isLoading =\n brands.isLoading ||\n items.isLoading ||\n looks.isLoading ||\n collaborations.isLoading ||\n wardrobe.isLoading;\n\n const isError = brands.isError && items.isError && looks.isError && collaborations.isError;\n\n const stats = useMemo<DashboardStats>(() => {\n const brandItems = brands.data?.items ?? [];\n const styleItems = items.data?.items ?? [];\n const lookItems = looks.data?.items ?? [];\n const collabs = collaborations.data ?? [];\n const wardrobeItems = wardrobe.data ?? [];\n return {\n totalBrands: brandItems.length,\n publishedBrands: brandItems.filter((b) => b.status === 'PUBLISHED').length,\n totalStyleItems: styleItems.length,\n activeStyleItems: styleItems.filter((i) => i.status === 'ACTIVE').length,\n totalLooks: lookItems.length,\n featuredLooks: lookItems.filter((l) => l.isFeatured).length,\n activeCollaborations: collabs.filter(\n (c) => c.status === 'ACCEPTED' || c.status === 'IN_PROGRESS'\n ).length,\n wardrobeItems: wardrobeItems.length,\n };\n }, [brands.data, items.data, looks.data, collaborations.data, wardrobe.data]);\n\n const latestLooks = useMemo(() => [...(looks.data?.items ?? [])].slice(0, 5), [looks.data]);\n\n const recentBrands = useMemo(\n () =>\n [...(brands.data?.items ?? [])]\n .sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime())\n .slice(0, 4),\n [brands.data]\n );\n\n if (isLoading) {\n return (\n <PageLayout title=\"CoolAndLovely\">\n <LoadingView label=\"Loading your style command center…\" />\n </PageLayout>\n );\n }\n\n if (isError) {\n return (\n <PageLayout title=\"CoolAndLovely\">\n <ErrorView\n title=\"Could not load CoolAndLovely\"\n message=\"The fashion service did not respond. Please try again.\"\n onRetry={() => {\n void brands.refetch();\n void items.refetch();\n void looks.refetch();\n void collaborations.refetch();\n void wardrobe.refetch();\n }}\n />\n </PageLayout>\n );\n }\n\n const metrics = [\n {\n icon: <Store className=\"h-5 w-5\" />,\n value: stats.totalBrands.toString(),\n label: 'Brands',\n sub: `${stats.publishedBrands} published`,\n },\n {\n icon: <Shirt className=\"h-5 w-5\" />,\n value: stats.totalStyleItems.toString(),\n label: 'Style Items',\n sub: `${stats.activeStyleItems} active`,\n },\n {\n icon: <Sparkles className=\"h-5 w-5\" />,\n value: stats.totalLooks.toString(),\n label: 'Looks',\n sub: `${stats.featuredLooks} featured`,\n },\n {\n icon: <Handshake className=\"h-5 w-5\" />,\n value: stats.activeCollaborations.toString(),\n label: 'Active Collabs',\n sub: `${stats.wardrobeItems} in wardrobe`,\n },\n ];\n\n return (\n <PageLayout\n title={`${greeting()}, ${firstName}`}\n description=\"Your fashion & lifestyle command center\"\n hero\n >\n <PagePurpose className=\"mb-6\">\n CoolAndLovely connects the three sides of style on one workspace-native model: brands launch\n storefronts and seasonal collections, you build a wardrobe and lookbooks, and creators\n publish shop-the-look outfits and run brand collaborations. Jump into any module below — all\n data is live from the CoolAndLovely service.\n </PagePurpose>\n\n {/* Headline metrics — the one emphasis zone for this page */}\n <EmphasisPanel className=\"mb-8\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">At a glance</h2>\n <div className=\"grid grid-cols-2 gap-4 lg:grid-cols-4\">\n {metrics.map((m, index) => (\n <MetricsCard\n key={m.label}\n icon={m.icon}\n value={m.value}\n label={m.label}\n trendValue={m.sub}\n trend=\"neutral\"\n featured={index === 0}\n />\n ))}\n </div>\n </EmphasisPanel>\n\n {/* Quick Actions */}\n <section className=\"mb-8\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">Quick actions</h2>\n <div className=\"grid grid-cols-2 gap-4 lg:grid-cols-4\">\n {quickActions.map((action) => (\n <button\n key={action.label}\n type=\"button\"\n onClick={() => navigateTo(action.path)}\n className={cn(\n 'flex items-start gap-3 rounded-lg border border-border-seam bg-bg-surface p-4 text-left shadow-sm transition-all',\n 'hover:border-accent-foreground/20 hover:shadow-md'\n )}\n >\n <div\n className={cn(\n 'flex h-10 w-10 shrink-0 items-center justify-center rounded-lg',\n action.color\n )}\n >\n {action.icon}\n </div>\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold text-text-primary\">{action.label}</p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">{action.description}</p>\n </div>\n <Plus className=\"mt-1 h-4 w-4 shrink-0 text-text-secondary\" />\n </button>\n ))}\n </div>\n </section>\n\n {/* Modules */}\n <section className=\"mb-8\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">Explore</h2>\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4\">\n {modules.map((mod) => (\n <button\n key={mod.label}\n type=\"button\"\n onClick={() => navigateTo(mod.path)}\n className=\"flex flex-col gap-3 rounded-lg border border-border-seam bg-bg-surface p-5 text-left transition-all hover:border-accent-foreground/20 hover:shadow-md\"\n >\n <div\n className={cn('flex h-12 w-12 items-center justify-center rounded-full', mod.color)}\n >\n {mod.icon}\n </div>\n <div>\n <p className=\"text-sm font-semibold text-text-primary\">{mod.label}</p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">{mod.description}</p>\n </div>\n </button>\n ))}\n </div>\n </section>\n\n {/* Latest looks */}\n <section className=\"mb-8\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Latest looks</h2>\n <button\n type=\"button\"\n onClick={() => navigateTo('/looks')}\n className=\"flex items-center gap-1 text-sm font-medium text-primary hover:underline\"\n >\n View all <ArrowRight className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n {latestLooks.length === 0 ? (\n <p className=\"rounded-lg border border-border-seam bg-bg-surface p-6 text-sm text-text-secondary\">\n No looks published yet. Be the first to publish a shop-the-look outfit.\n </p>\n ) : (\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-5\">\n {latestLooks.map((look) => (\n <LookCard\n key={look.id}\n id={look.id}\n title={look.title}\n occasion={look.occasion}\n imageFileId={look.image?.id}\n likeCount={look.likeCount}\n isLikedByMe={look.isLikedByMe}\n isSavedByMe={look.isSavedByMe}\n onOpen={() => navigateTo(`/looks/${look.id}`)}\n showActions\n />\n ))}\n </div>\n )}\n </section>\n\n {/* Recent brands */}\n {recentBrands.length > 0 && (\n <section>\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Recently updated brands</h2>\n <button\n type=\"button\"\n onClick={() => navigateTo('/brands')}\n className=\"flex items-center gap-1 text-sm font-medium text-primary hover:underline\"\n >\n View all <ArrowRight className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n {recentBrands.map((brand) => (\n <button\n key={brand.id}\n type=\"button\"\n onClick={() => navigateTo(`/brands/${brand.id}`)}\n className=\"group flex items-center gap-3 rounded-xl border border-border-seam bg-bg-surface p-3 text-left shadow-sm transition-all hover:border-accent-foreground/20 hover:shadow-md\"\n >\n <Thumbnail\n icon={<Store className=\"h-5 w-5\" />}\n seed={brand.id}\n fileId={brand.logo?.id ?? brand.cover?.id}\n alt={brand.name}\n className=\"h-11 w-11 shrink-0 rounded-full ring-2 ring-bg-surface\"\n />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-1.5\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{brand.name}</p>\n {brand.isFeatured && (\n <Star className=\"h-3.5 w-3.5 shrink-0 fill-status-warning-text text-status-warning-text\" />\n )}\n </div>\n <p className=\"truncate text-xs text-text-secondary\">@{brand.handle}</p>\n </div>\n <StatusBadge status={brand.status} />\n </button>\n ))}\n </div>\n </section>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsCA,SAAS,IAAmB;CAC1B,IAAM,qBAAO,IAAI,MAAM,EAAC,UAAU;AAGlC,QAFI,IAAO,KAAW,iBAClB,IAAO,KAAW,mBACf;;AAWT,IAAM,IAA8B;CAClC;EACE,OAAO;EACP,aAAa;EACb,MAAM,kBAAC,GAAD,EAAO,WAAU,WAAY,CAAA;EACnC,MAAM;EACN,OAAO;EACR;CACD;EACE,OAAO;EACP,aAAa;EACb,MAAM,kBAAC,GAAD,EAAO,WAAU,WAAY,CAAA;EACnC,MAAM;EACN,OAAO;EACR;CACD;EACE,OAAO;EACP,aAAa;EACb,MAAM,kBAAC,GAAD,EAAU,WAAU,WAAY,CAAA;EACtC,MAAM;EACN,OAAO;EACR;CACD;EACE,OAAO;EACP,aAAa;EACb,MAAM,kBAAC,GAAD,EAAO,WAAU,WAAY,CAAA;EACnC,M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,KAAE,EAAM,OAAW;UACnE;;MACN,kBAAC,GAAD,EAAa,QAAQ,EAAM,QAAU,CAAA;MAC9B;OAtBF,EAAM,GAsBJ,CACT;IACE,CAAA,CACE,EAAA,CAAA;GAED"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyleItemDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/items/StyleItemDetailPage.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkBH,wBAAgB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"StyleItemDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/items/StyleItemDetailPage.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkBH,wBAAgB,mBAAmB,gCA2PlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyleItemDetailPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/items/StyleItemDetailPage.tsx"],"sourcesContent":["/**\n * Style Item Detail Page\n * @module coolandlovely/pages/items\n *\n * Renders a single catalogue piece (`cooStyleItem`) with edit + archive\n * (`cooArchiveStyleItem`) actions.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { ArrowLeft, Pencil, Archive, Loader2, ChevronRight, Shapes } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { Thumbnail } from '../../components/Thumbnail';\nimport { LookCard } from '../../components/LookCard';\nimport { TagList } from '../../components/TagList';\nimport { ColourSwatchRow } from '../../components/ColourSwatchRow';\nimport { AddToLookbookButton } from '../../components/AddToLookbookButton';\nimport { useCoolAndLovely } from '../../context/CoolAndLovelyContext';\nimport { useStyleItem, useArchiveStyleItem, useLooksWithItems } from '../../hooks';\nimport { categoryIcon } from '../../utils/icons';\nimport { formatPrice, formatDate, titleCase } from '../../utils/formatters';\n\nexport function StyleItemDetailPage() {\n const { itemId } = useParams<{ itemId: string }>();\n const { navigateTo } = useCoolAndLovely();\n const query = useStyleItem(itemId);\n const looksQuery = useLooksWithItems({ pagination: { limit: 100, offset: 0 } });\n const archive = useArchiveStyleItem();\n\n if (query.isLoading) {\n return (\n <PageLayout title=\"Style item\">\n <LoadingView label=\"Loading item…\" />\n </PageLayout>\n );\n }\n\n if (query.isError || !query.data) {\n return (\n <PageLayout title=\"Style item\">\n <ErrorView title=\"Item not found\" onRetry={() => void query.refetch()} />\n </PageLayout>\n );\n }\n\n const item = query.data;\n const isArchived = item.status === 'RETIRED';\n const appearsInLooks = (looksQuery.data?.items ?? [])\n .filter((look) => look.items?.some((lookItem) => lookItem.styleItemId === item.id))\n .slice(0, 4);\n\n return (\n <PageLayout\n title={item.name}\n description={item.brand?.name ?? undefined}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => navigateTo('/items')}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n <ArrowLeft className=\"h-4 w-4\" /> Back\n </button>\n <AddToLookbookButton styleItemId={item.id} />\n <button\n type=\"button\"\n onClick={() => navigateTo(`/items/${item.id}/edit`)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90\"\n >\n <Pencil className=\"h-4 w-4\" /> Edit\n </button>\n {!isArchived && (\n <button\n type=\"button\"\n disabled={archive.isPending}\n onClick={() => archive.mutate(item.id, { onSuccess: () => navigateTo('/items') })}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-status-error-text transition-colors hover:bg-status-error-bg-subtle disabled:opacity-50\"\n >\n {archive.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Archive className=\"h-4 w-4\" />\n )}\n Archive\n </button>\n )}\n </div>\n }\n >\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Product image */}\n <div className=\"lg:col-span-2\">\n <GlassCard treatment=\"glass\" className=\"group overflow-hidden p-0\">\n <Thumbnail\n icon={categoryIcon(item.category, 48)}\n seed={item.id}\n fileId={item.image?.id}\n alt={item.name}\n className=\"aspect-[4/5] w-full\"\n />\n {item.description && (\n <div className=\"p-6\">\n <p className=\"text-sm leading-relaxed text-text-secondary\">{item.description}</p>\n </div>\n )}\n </GlassCard>\n </div>\n\n {/* Product panel */}\n <div className=\"space-y-4\">\n <GlassCard treatment=\"glass\" className=\"space-y-5 p-6\">\n <div>\n <h2 className=\"text-2xl font-semibold leading-tight text-text-primary\">\n {item.name}\n </h2>\n {item.brand && (\n <button\n type=\"button\"\n onClick={() => navigateTo(`/brands/${item.brand?.id}`)}\n className=\"mt-1 inline-flex items-center gap-0.5 text-sm font-medium text-action-primary-bg hover:underline\"\n >\n {item.brand.name}\n <ChevronRight className=\"h-3.5 w-3.5\" />\n </button>\n )}\n <div className=\"mt-3 flex flex-wrap items-center justify-between gap-2\">\n <p className=\"text-3xl font-bold text-text-primary tabular-nums\">\n {formatPrice(item.price, item.currency)}\n <span className=\"ml-2 text-base font-medium text-text-secondary\">\n {item.currency}\n </span>\n </p>\n <StatusBadge status={item.status} />\n </div>\n </div>\n\n <div className=\"border-t border-border-seam\" />\n\n {item.colours.length > 0 && (\n <div>\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n Colours\n </p>\n <ColourSwatchRow colours={item.colours} max={12} />\n </div>\n )}\n\n {item.sizes.length > 0 && (\n <div>\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n Size\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {item.sizes.map((size) => (\n <span\n key={size}\n className=\"inline-flex min-w-9 items-center justify-center rounded-full border border-border-seam px-3 py-1 text-sm font-medium text-text-primary\"\n >\n {size}\n </span>\n ))}\n </div>\n </div>\n )}\n\n {item.materials.length > 0 && (\n <div>\n <p className=\"mb-1 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n Materials\n </p>\n <p className=\"text-sm text-text-primary\">{item.materials.join(', ')}</p>\n </div>\n )}\n\n {item.tags.length > 0 && (\n <div>\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n Tags\n </p>\n <TagList tags={item.tags} max={12} tone=\"accent\" />\n </div>\n )}\n </GlassCard>\n\n <GlassCard treatment=\"plain\" className=\"p-5\">\n <h3 className=\"mb-3 text-sm font-semibold text-text-primary\">Details</h3>\n <dl className=\"space-y-2 text-sm\">\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Category</dt>\n <dd className=\"text-text-primary\">{titleCase(item.category)}</dd>\n </div>\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">SKU</dt>\n <dd className=\"text-text-primary\">{item.sku ?? '—'}</dd>\n </div>\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Currency</dt>\n <dd className=\"text-text-primary\">{item.currency}</dd>\n </div>\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Created</dt>\n <dd className=\"text-text-primary\">\n {formatDate(item.createdAt, { hour: undefined, minute: undefined })}\n </dd>\n </div>\n </dl>\n </GlassCard>\n\n {item.collection && (\n <button\n type=\"button\"\n onClick={() => navigateTo(`/collections/${item.collection?.id}`)}\n className=\"flex w-full items-center gap-3 rounded-lg border border-border-seam bg-bg-surface p-4 text-left transition-colors hover:bg-bg-sunken/50\"\n >\n <Thumbnail\n icon={<Shapes className=\"h-5 w-5\" />}\n seed={item.collection.id}\n className=\"h-10 w-10 shrink-0\"\n />\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {item.collection.name}\n </p>\n <p className=\"truncate text-xs text-text-secondary\">View collection</p>\n </div>\n </button>\n )}\n </div>\n </div>\n\n <section className=\"mt-8\">\n <div className=\"mb-3 flex items-center justify-between gap-3\">\n <h3 className=\"text-lg font-semibold text-text-primary\">Appears in looks</h3>\n {appearsInLooks.length > 0 && (\n <button\n type=\"button\"\n onClick={() => navigateTo('/looks')}\n className=\"inline-flex items-center gap-1 text-sm font-medium text-action-primary-bg hover:underline\"\n >\n View all <ChevronRight className=\"h-3.5 w-3.5\" />\n </button>\n )}\n </div>\n {looksQuery.isLoading ? (\n <div className=\"flex items-center gap-2 rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary\">\n <Loader2 className=\"h-4 w-4 animate-spin\" /> Loading referenced looks…\n </div>\n ) : appearsInLooks.length === 0 ? (\n <p className=\"rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary\">\n This piece has not been tagged in any looks yet.\n </p>\n ) : (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n {appearsInLooks.map((look) => (\n <LookCard\n key={look.id}\n id={look.id}\n title={look.title}\n occasion={look.occasion}\n imageFileId={look.image?.id}\n likeCount={look.likeCount}\n onOpen={() => navigateTo(`/looks/${look.id}`)}\n showActions\n />\n ))}\n </div>\n )}\n </section>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,SAAgB,IAAsB;CACpC,IAAM,EAAE,cAAW,GAA+B,EAC5C,EAAE,kBAAe,GAAkB,EACnC,IAAQ,EAAa,EAAO,EAC5B,IAAa,EAAkB,EAAE,YAAY;EAAE,OAAO;EAAK,QAAQ;EAAG,EAAE,CAAC,EACzE,IAAU,GAAqB;AAErC,KAAI,EAAM,UACR,QACE,kBAAC,GAAD;EAAY,OAAM;YAChB,kBAAC,GAAD,EAAa,OAAM,iBAAkB,CAAA;EAC1B,CAAA;AAIjB,KAAI,EAAM,WAAW,CAAC,EAAM,KAC1B,QACE,kBAAC,GAAD;EAAY,OAAM;YAChB,kBAAC,GAAD;GAAW,OAAM;GAAiB,eAAe,KAAK,EAAM,SA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E,MAAK;MACL,eAAe,EAAW,gBAAgB,EAAK,YAAY,KAAK;MAChE,WAAU;gBAHZ,CAKE,kBAAC,GAAD;OACE,MAAM,kBAAC,GAAD,EAAQ,WAAU,WAAY,CAAA;OACpC,MAAM,EAAK,WAAW;OACtB,WAAU;OACV,CAAA,EACF,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,KAAD;QAAG,WAAU;kBACV,EAAK,WAAW;QACf,CAAA,EACJ,kBAAC,KAAD;QAAG,WAAU;kBAAuC;QAAmB,CAAA,CACnE;SACC;;KAEP;MACF;MAEN,kBAAC,WAAD;GAAS,WAAU;aAAnB,CACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,MAAD;KAAI,WAAU;eAA0C;KAAqB,CAAA,EAC5E,EAAe,SAAS,KACvB,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,EAAW,SAAS;KACnC,WAAU;eAHZ,CAIC,aACU,kBAAC,GAAD,EAAc,WAAU,eAAgB,CAAA,CAC1C;OAEP;OACL,EAAW,YACV,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD,EAAS,WAAU,wBAAyB,CAAA,EAAA,6BACxC;QACJ,EAAe,WAAW,IAC5B,kBAAC,KAAD;IAAG,WAAU;cAAqF;IAE9F,CAAA,GAEJ,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAe,KAAK,MACnB,kBAAC,GAAD;KAEE,IAAI,EAAK;KACT,OAAO,EAAK;KACZ,UAAU,EAAK;KACf,aAAa,EAAK,OAAO;KACzB,WAAW,EAAK;KAChB,cAAc,EAAW,UAAU,EAAK,KAAK;KAC7C,aAAA;KACA,EARK,EAAK,GAQV,CACF;IACE,CAAA,CAEA;KACC"}
|
|
1
|
+
{"version":3,"file":"StyleItemDetailPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/items/StyleItemDetailPage.tsx"],"sourcesContent":["/**\n * Style Item Detail Page\n * @module coolandlovely/pages/items\n *\n * Renders a single catalogue piece (`cooStyleItem`) with edit + archive\n * (`cooArchiveStyleItem`) actions.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { ArrowLeft, Pencil, Archive, Loader2, ChevronRight, Shapes } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { Thumbnail } from '../../components/Thumbnail';\nimport { LookCard } from '../../components/LookCard';\nimport { TagList } from '../../components/TagList';\nimport { ColourSwatchRow } from '../../components/ColourSwatchRow';\nimport { AddToLookbookButton } from '../../components/AddToLookbookButton';\nimport { useCoolAndLovely } from '../../context/CoolAndLovelyContext';\nimport { useStyleItem, useArchiveStyleItem, useLooksWithItems } from '../../hooks';\nimport { categoryIcon } from '../../utils/icons';\nimport { formatPrice, formatDate, titleCase } from '../../utils/formatters';\n\nexport function StyleItemDetailPage() {\n const { itemId } = useParams<{ itemId: string }>();\n const { navigateTo } = useCoolAndLovely();\n const query = useStyleItem(itemId);\n const looksQuery = useLooksWithItems({ pagination: { limit: 100, offset: 0 } });\n const archive = useArchiveStyleItem();\n\n if (query.isLoading) {\n return (\n <PageLayout title=\"Style item\">\n <LoadingView label=\"Loading item…\" />\n </PageLayout>\n );\n }\n\n if (query.isError || !query.data) {\n return (\n <PageLayout title=\"Style item\">\n <ErrorView title=\"Item not found\" onRetry={() => void query.refetch()} />\n </PageLayout>\n );\n }\n\n const item = query.data;\n const isArchived = item.status === 'RETIRED';\n const appearsInLooks = (looksQuery.data?.items ?? [])\n .filter((look) => look.items?.some((lookItem) => lookItem.styleItemId === item.id))\n .slice(0, 4);\n\n return (\n <PageLayout\n title={item.name}\n description={item.brand?.name ?? undefined}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => navigateTo('/items')}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n <ArrowLeft className=\"h-4 w-4\" /> Back\n </button>\n <AddToLookbookButton styleItemId={item.id} />\n <button\n type=\"button\"\n onClick={() => navigateTo(`/items/${item.id}/edit`)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90\"\n >\n <Pencil className=\"h-4 w-4\" /> Edit\n </button>\n {!isArchived && (\n <button\n type=\"button\"\n disabled={archive.isPending}\n onClick={() => archive.mutate(item.id, { onSuccess: () => navigateTo('/items') })}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-status-error-text transition-colors hover:bg-status-error-bg-subtle disabled:opacity-50\"\n >\n {archive.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Archive className=\"h-4 w-4\" />\n )}\n Archive\n </button>\n )}\n </div>\n }\n >\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Product image */}\n <div className=\"lg:col-span-2\">\n <GlassCard treatment=\"glass\" className=\"group overflow-hidden p-0\">\n <Thumbnail\n icon={categoryIcon(item.category, 48)}\n seed={item.id}\n fileId={item.image?.id}\n alt={item.name}\n className=\"aspect-[4/5] w-full\"\n />\n {item.description && (\n <div className=\"p-6\">\n <p className=\"text-sm leading-relaxed text-text-secondary\">{item.description}</p>\n </div>\n )}\n </GlassCard>\n </div>\n\n {/* Product panel */}\n <div className=\"space-y-4\">\n <GlassCard treatment=\"glass\" className=\"space-y-5 p-6\">\n <div>\n <h2 className=\"text-2xl font-semibold leading-tight text-text-primary\">\n {item.name}\n </h2>\n {item.brand && (\n <button\n type=\"button\"\n onClick={() => navigateTo(`/brands/${item.brand?.id}`)}\n className=\"mt-1 inline-flex items-center gap-0.5 text-sm font-medium text-action-primary-bg hover:underline\"\n >\n {item.brand.name}\n <ChevronRight className=\"h-3.5 w-3.5\" />\n </button>\n )}\n <div className=\"mt-3 flex flex-wrap items-center justify-between gap-2\">\n <p className=\"text-3xl font-bold text-text-primary tabular-nums\">\n {formatPrice(item.price, item.currency)}\n <span className=\"ml-2 text-base font-medium text-text-secondary\">\n {item.currency}\n </span>\n </p>\n <StatusBadge status={item.status} />\n </div>\n </div>\n\n <div className=\"border-t border-border-seam\" />\n\n {item.colours.length > 0 && (\n <div>\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n Colours\n </p>\n <ColourSwatchRow colours={item.colours} max={12} />\n </div>\n )}\n\n {item.sizes.length > 0 && (\n <div>\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n Size\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {item.sizes.map((size) => (\n <span\n key={size}\n className=\"inline-flex min-w-9 items-center justify-center rounded-full border border-border-seam px-3 py-1 text-sm font-medium text-text-primary\"\n >\n {size}\n </span>\n ))}\n </div>\n </div>\n )}\n\n {item.materials.length > 0 && (\n <div>\n <p className=\"mb-1 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n Materials\n </p>\n <p className=\"text-sm text-text-primary\">{item.materials.join(', ')}</p>\n </div>\n )}\n\n {item.tags.length > 0 && (\n <div>\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n Tags\n </p>\n <TagList tags={item.tags} max={12} tone=\"accent\" />\n </div>\n )}\n </GlassCard>\n\n <GlassCard treatment=\"plain\" className=\"p-5\">\n <h3 className=\"mb-3 text-sm font-semibold text-text-primary\">Details</h3>\n <dl className=\"space-y-2 text-sm\">\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Category</dt>\n <dd className=\"text-text-primary\">{titleCase(item.category)}</dd>\n </div>\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">SKU</dt>\n <dd className=\"text-text-primary\">{item.sku ?? '—'}</dd>\n </div>\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Currency</dt>\n <dd className=\"text-text-primary\">{item.currency}</dd>\n </div>\n <div className=\"flex justify-between gap-2\">\n <dt className=\"text-text-secondary\">Created</dt>\n <dd className=\"text-text-primary\">\n {formatDate(item.createdAt, { hour: undefined, minute: undefined })}\n </dd>\n </div>\n </dl>\n </GlassCard>\n\n {item.collection && (\n <button\n type=\"button\"\n onClick={() => navigateTo(`/collections/${item.collection?.id}`)}\n className=\"flex w-full items-center gap-3 rounded-lg border border-border-seam bg-bg-surface p-4 text-left transition-colors hover:bg-bg-sunken/50\"\n >\n <Thumbnail\n icon={<Shapes className=\"h-5 w-5\" />}\n seed={item.collection.id}\n className=\"h-10 w-10 shrink-0\"\n />\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {item.collection.name}\n </p>\n <p className=\"truncate text-xs text-text-secondary\">View collection</p>\n </div>\n </button>\n )}\n </div>\n </div>\n\n <section className=\"mt-8\">\n <div className=\"mb-3 flex items-center justify-between gap-3\">\n <h3 className=\"text-lg font-semibold text-text-primary\">Appears in looks</h3>\n {appearsInLooks.length > 0 && (\n <button\n type=\"button\"\n onClick={() => navigateTo('/looks')}\n className=\"inline-flex items-center gap-1 text-sm font-medium text-action-primary-bg hover:underline\"\n >\n View all <ChevronRight className=\"h-3.5 w-3.5\" />\n </button>\n )}\n </div>\n {looksQuery.isLoading ? (\n <div className=\"flex items-center gap-2 rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary\">\n <Loader2 className=\"h-4 w-4 animate-spin\" /> Loading referenced looks…\n </div>\n ) : appearsInLooks.length === 0 ? (\n <p className=\"rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary\">\n This piece has not been tagged in any looks yet.\n </p>\n ) : (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n {appearsInLooks.map((look) => (\n <LookCard\n key={look.id}\n id={look.id}\n title={look.title}\n occasion={look.occasion}\n imageFileId={look.image?.id}\n likeCount={look.likeCount}\n isLikedByMe={look.isLikedByMe}\n isSavedByMe={look.isSavedByMe}\n onOpen={() => navigateTo(`/looks/${look.id}`)}\n showActions\n />\n ))}\n </div>\n )}\n </section>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,SAAgB,IAAsB;CACpC,IAAM,EAAE,cAAW,GAA+B,EAC5C,EAAE,kBAAe,GAAkB,EACnC,IAAQ,EAAa,EAAO,EAC5B,IAAa,EAAkB,EAAE,YAAY;EAAE,OAAO;EAAK,QAAQ;EAAG,EAAE,CAAC,EACzE,IAAU,GAAqB;AAErC,KAAI,EAAM,UACR,QACE,kBAAC,GAAD;EAAY,OAAM;YAChB,kBAAC,GAAD,EAAa,OAAM,iBAAkB,CAAA;EAC1B,CAAA;AAIjB,KAAI,EAAM,WAAW,CAAC,EAAM,KAC1B,QACE,kBAAC,GAAD;EAAY,OAAM;YAChB,kBAAC,GAAD;GAAW,OAAM;GAAiB,eAAe,KAAK,EAAM,SAAS;GAAI,CAAA;EAC9D,CAAA;CAIjB,IAAM,IAAO,EAAM,MACb,IAAa,EAAK,WAAW,WAC7B,KAAkB,EAAW,MAAM,SAAS,EAAE,EACjD,QAAQ,MAAS,EAAK,OAAO,MAAM,MAAa,EAAS,gBAAgB,EAAK,GAAG,CAAC,CAClF,MAAM,GAAG,EAAE;AAEd,QACE,kBAAC,GAAD;EACE,OAAO,EAAK;EACZ,aAAa,EAAK,OAAO,QAAQ,KAAA;EACjC,SACE,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,EAAW,SAAS;KACnC,WAAU;eAHZ,CAKE,kBAAC,GAAD,EAAW,WAAU,WAAY,CAAA,EAAA,QAC1B;;IACT,kBAAC,GAAD,EAAqB,aAAa,EAAK,IAAM,CAAA;IAC7C,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,EAAW,UAAU,EAAK,GAAG,OAAO;KACnD,WAAU;eAHZ,CAKE,kBAAC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B,CAAA,CAC1C;OAEP;OACL,EAAW,YACV,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD,EAAS,WAAU,wBAAyB,CAAA,EAAA,6BACxC;QACJ,EAAe,WAAW,IAC5B,kBAAC,KAAD;IAAG,WAAU;cAAqF;IAE9F,CAAA,GAEJ,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAe,KAAK,MACnB,kBAAC,GAAD;KAEE,IAAI,EAAK;KACT,OAAO,EAAK;KACZ,UAAU,EAAK;KACf,aAAa,EAAK,OAAO;KACzB,WAAW,EAAK;KAChB,aAAa,EAAK;KAClB,aAAa,EAAK;KAClB,cAAc,EAAW,UAAU,EAAK,KAAK;KAC7C,aAAA;KACA,EAVK,EAAK,GAUV,CACF;IACE,CAAA,CAEA;KACC"}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Look Detail Page
|
|
3
3
|
* @module coolandlovely/pages/looks
|
|
4
4
|
*
|
|
5
|
-
* Single look (`cooLook`) with its look items,
|
|
6
|
-
* (`
|
|
5
|
+
* Single look (`cooLook`) with its look items, a true-toggle like
|
|
6
|
+
* (`cooLikeLook` / `cooUnlikeLook`), a true-toggle save (`cooSaveLook` /
|
|
7
|
+
* `cooUnsaveLook`), publish (`cooPublishLook`) and delete (`cooDeleteLook`)
|
|
8
|
+
* actions.
|
|
7
9
|
*/
|
|
8
10
|
export declare function LookDetailPage(): import("react").JSX.Element;
|
|
9
11
|
//# sourceMappingURL=LookDetailPage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LookDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/looks/LookDetailPage.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"LookDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/looks/LookDetailPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA+EH,wBAAgB,cAAc,gCA2R7B"}
|