Skip to content

Commit

Permalink
refactor: update PropertyShopsResponse to use 'dummy_record' instead …
Browse files Browse the repository at this point in the history
…of 'on_display' and adjust related components
  • Loading branch information
tigawanna committed Dec 30, 2024
1 parent 200e77f commit 1022d7f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@tanstack/react-router": "^1.58.3",
"@tanstack/router-devtools": "^1.58.3",
"@tanstack/zod-form-adapter": "^0.33.0",
"@tigawanna/typed-pocketbase": "link:/home/dennis/Desktop/code/npm/typed-pocketbase",
"@tigawanna/typed-pocketbase": "0.0.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"cmdk": "1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/components/shadcn/ui/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const TabsList = React.forwardRef<
<TabsPrimitive.List
ref={ref}
className={cn(
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
"inline-flex h-10 items-center justify-center gap-1 rounded-md bg-muted p-1 text-muted-foreground",
className,
)}
{...props}
Expand All @@ -29,7 +29,7 @@ const TabsTrigger = React.forwardRef<
<TabsPrimitive.Trigger
ref={ref}
className={cn(
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
"inline-flex items-center justify-center whitespace-nowrap border border-base-300 rounded px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
className,
)}
{...props}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/pb/pb-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ export interface PropertyShopsResponse extends BaseCollectionResponse {
order: number;
is_vacant: boolean;
monthly_rent: number;
on_display: boolean;
dummy_record: boolean;
gallery: Array<string>;
created: string;
updated: string;
Expand All @@ -541,7 +541,7 @@ export interface PropertyShopsCreate extends BaseCollectionCreate {
order?: number;
is_vacant?: boolean;
monthly_rent?: number;
on_display?: boolean;
dummy_record?: boolean;
gallery?: MaybeArray<File>;
created?: string | Date;
updated?: string | Date;
Expand All @@ -559,7 +559,7 @@ export interface PropertyShopsUpdate extends BaseCollectionUpdate {
monthly_rent?: number;
'monthly_rent+'?: number;
'monthly_rent-'?: number;
on_display?: boolean;
dummy_record?: boolean;
gallery?: MaybeArray<File>;
'gallery-'?: string;
created?: string | Date;
Expand Down
11 changes: 9 additions & 2 deletions src/routes/-components/HomeComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,30 @@ import {
import { Link } from "@tanstack/react-router";
import { ArrowRightIcon } from "lucide-react";
import { RoleIcons } from "./RoleIcons";
import { getFileURL } from "@/lib/pb/client";

interface ProfileLinkCardProps {
viewer: {
id: string;
staff?: string;
tenant?: string;
pnone?: string;
avatarUrl: string;
avatar: string;
username: string;
email: string;
};
}

export function ProfileLinkCard({viewer}:ProfileLinkCardProps){
const avatarUrl= getFileURL({
collection_id_or_name: "property_user",
fallback: "/avatar.png",
record_id: viewer?.id
})
return (
<Link to="/profile" className="group flex hover:brightness-125 items-center justify-center gap-2">
<Avatar>
<AvatarImage height={50} className="size-10" src={viewer?.avatarUrl} alt={viewer?.username} />
<AvatarImage height={50} className="size-10" src={avatarUrl} alt={viewer?.username} />
<AvatarFallback>{viewer?.username?.slice(0, 2)}</AvatarFallback>
</Avatar>
<div className="flex gap-10 justify-center items-center">
Expand Down
4 changes: 2 additions & 2 deletions src/routes/dashboard/shops/-components/list/ShopCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export function ShopCard({ item, cardClassname, variant }: ShopCardProps) {
{item.is_vacant && (
<div className="badge badge-primary badge-outline">Vacant</div>
)}
{item.on_display && (
<div className="badge badge-primary badge-outline">On Display</div>
{item.dummy_record && (
<div className="badge badge-primary badge-outline">Dummy shop</div>
)}
{item.utils === "elec" && (
<Zap className="fill-warning stroke-warning" />
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.tsbuildinfo

Large diffs are not rendered by default.

0 comments on commit 1022d7f

Please sign in to comment.