-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92aa03a
commit 632c748
Showing
8 changed files
with
89 additions
and
42 deletions.
There are no files selected for viewing
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,6 @@ | ||
-- CreateEnum | ||
CREATE TYPE "LostAndFoundItemStatus" AS ENUM ('ACTIVE', 'EXPIRED', 'BLOCKED'); | ||
|
||
-- AlterTable | ||
ALTER TABLE "LostAndFoundItem" ADD COLUMN "status" "LostAndFoundItemStatus" NOT NULL DEFAULT 'ACTIVE', | ||
ALTER COLUMN "expires" SET DEFAULT NOW() + interval '1 week'; |
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
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
29 changes: 29 additions & 0 deletions
29
src/components/posts/post-status-badge/post-status-badge.tsx
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,29 @@ | ||
import { type LostAndFoundItemStatus } from '@prisma/client' | ||
|
||
interface PostStatusBadgeProps { | ||
title?: string | ||
status: LostAndFoundItemStatus | ||
} | ||
|
||
export default function PostStatusBadge({ title, status }: PostStatusBadgeProps) { | ||
switch (status) { | ||
case 'ACTIVE': | ||
return ( | ||
<div className='inline-flex items-center rounded-md bg-green-50 px-2 py-1 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20'> | ||
{title ?? 'Активен'} | ||
</div> | ||
) | ||
case 'EXPIRED': | ||
return ( | ||
<div className='inline-flex items-center rounded-md bg-yellow-50 px-2 py-1 text-xs font-medium text-yellow-800 ring-1 ring-inset ring-yellow-600/20'> | ||
{title ?? 'Просрочен'} | ||
</div> | ||
) | ||
case 'BLOCKED': | ||
return ( | ||
<div className='inline-flex items-center rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-700 ring-1 ring-inset ring-red-600/10'> | ||
{title ?? 'Заблокирован'} | ||
</div> | ||
) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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