-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from ildecimo/develop
dev -> main
- Loading branch information
Showing
11 changed files
with
751 additions
and
273 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { NextResponse, type NextRequest } from 'next/server'; | ||
import { authorize } from '~/lib/authorize'; | ||
import * as db from '~/lib/db'; | ||
import { approveReview } from '~/server/bigcommerce-api'; | ||
|
||
export async function POST(req: NextRequest) { | ||
const authorized = authorize(); | ||
|
||
if (!authorized) { | ||
return new NextResponse('Unauthorized', { status: 401 }); | ||
} | ||
|
||
const accessToken = await db.getStoreToken(authorized.storeHash); | ||
|
||
if (!accessToken) { | ||
return new NextResponse( | ||
'Access token not found. Try to re-install the app.', | ||
{ status: 401 } | ||
); | ||
} | ||
|
||
const reqBody = (await req.json()) as { productId: number; reviewId: number }; | ||
|
||
const review = await approveReview({ | ||
...reqBody, | ||
accessToken, | ||
storeHash: authorized.storeHash, | ||
}); | ||
|
||
return NextResponse.json(review); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Image from 'next/image'; | ||
|
||
interface AIChatBubbleProps { | ||
message: string | React.ReactNode; | ||
hideAvatar?: boolean; | ||
} | ||
|
||
export const AIChatBubble = ({ message, hideAvatar }: AIChatBubbleProps) => { | ||
return ( | ||
<div className="mb-4 flex max-w-[450px] items-center"> | ||
{!hideAvatar && ( | ||
<div className="mr-4 flex flex-none flex-col items-center space-y-1"> | ||
<Image | ||
src="/images/vertex-ai.jpeg" | ||
alt="AI Avatar" | ||
width={32} | ||
height={32} | ||
className="rounded-full" | ||
/> | ||
<p className="block text-xs">Vertex AI</p> | ||
</div> | ||
)} | ||
<div | ||
className={`relative mb-2 flex-1 rounded-lg bg-gray-100/80 p-2 text-lg ${ | ||
hideAvatar ? 'ml-[60px]' : '' | ||
}`} | ||
> | ||
<div>{message}</div> | ||
|
||
{!hideAvatar && ( | ||
<div className="absolute left-0 top-1/2 h-2 w-2 -translate-x-1/2 rotate-45 transform bg-gray-100/80"></div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Badge } from '@bigcommerce/big-design'; | ||
|
||
interface IssuesBadgesProps { | ||
issuesCategoriesArray: string[]; | ||
} | ||
|
||
export const IssuesBadges = ({ issuesCategoriesArray }: IssuesBadgesProps) => { | ||
return ( | ||
<div className="flex flex-wrap items-center"> | ||
<span className="mr-2">Issues found:</span> | ||
|
||
{issuesCategoriesArray.map((issue) => ( | ||
<Badge | ||
key={issue} | ||
label={issue} | ||
variant={issue === 'no issues' ? 'success' : 'danger'} | ||
> | ||
{issue} | ||
</Badge> | ||
))} | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.