Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(eslint): add arrow-body-style ESLint rule #347

Merged
merged 3 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Run this command to always ignore these commits in `git blame`:
# git config --local blame.ignoreRevsFile .git-blame-ignore-revs

064151d6b9d66fa6b9480cdaecbe5714982d810b
1f7eb309b14e0b0f1c5bea7030336c266eca53f3
2f48d92b28eb16b0410551a62e5286b73e55263c
24 changes: 13 additions & 11 deletions app/(dashboard)/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ export default function DashboardPage() {
[pullRequests],
);

const filteredPullRequests = useMemo(() => {
return pullRequests.filter((pr) => {
const repoMatch =
selectedRepoFilters.length === 0 ||
selectedRepoFilters.includes(pr.repository.full_name);
const statusMatch =
buildStatusFilter.length === 0 ||
buildStatusFilter.includes(pr.buildStatus.toLowerCase());
return repoMatch && statusMatch;
});
}, [pullRequests, selectedRepoFilters, buildStatusFilter]);
const filteredPullRequests = useMemo(
() =>
pullRequests.filter((pr) => {
const repoMatch =
selectedRepoFilters.length === 0 ||
selectedRepoFilters.includes(pr.repository.full_name);
const statusMatch =
buildStatusFilter.length === 0 ||
buildStatusFilter.includes(pr.buildStatus.toLowerCase());
return repoMatch && statusMatch;
}),
[pullRequests, selectedRepoFilters, buildStatusFilter],
);

const handleRepoFilterChange = (value: string) => {
setSelectedRepoFilters((prev) =>
Expand Down
110 changes: 53 additions & 57 deletions app/(dashboard)/dashboard/pull-request-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,19 @@ const FilterOption = ({
checked,
onCheckedChange,
capitalize = false,
}: FilterOptionProps) => {
return (
<div className="flex items-center space-x-2 p-2 hover:bg-accent hover:text-accent-foreground">
<Checkbox id={id} checked={checked} onCheckedChange={onCheckedChange} />
<label
htmlFor={id}
className={`flex-grow text-sm cursor-pointer ${
capitalize ? "capitalize" : ""
}`}
>
{label}
</label>
</div>
);
};
}: FilterOptionProps) => (
<div className="flex items-center space-x-2 p-2 hover:bg-accent hover:text-accent-foreground">
<Checkbox id={id} checked={checked} onCheckedChange={onCheckedChange} />
<label
htmlFor={id}
className={`flex-grow text-sm cursor-pointer ${
capitalize ? "capitalize" : ""
}`}
>
{label}
</label>
</div>
);

interface FilterSectionProps {
label: string;
Expand All @@ -55,48 +53,46 @@ const FilterSection = ({
onOptionChange,
capitalize = false,
disabled = false,
}: FilterSectionProps) => {
return (
<div className="flex flex-col space-y-1.5">
<label
htmlFor={`${label.toLowerCase()}-filter`}
className="text-sm font-medium text-muted-foreground"
>
{label}
</label>
<Popover>
<PopoverTrigger asChild>
<Button
id={`${label.toLowerCase()}-filter`}
variant="outline"
role="combobox"
className="w-full sm:w-[200px] justify-between"
disabled={disabled}
>
{buttonText}
<ChevronDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
</PopoverTrigger>
{!disabled && (
<PopoverContent className="w-full sm:w-[200px] p-0">
<div className="max-h-[300px] overflow-y-auto">
{options.map((option) => (
<FilterOption
key={option}
id={option}
label={option}
checked={selectedOptions.includes(option)}
onCheckedChange={() => onOptionChange(option)}
capitalize={capitalize}
/>
))}
</div>
</PopoverContent>
)}
</Popover>
</div>
);
};
}: FilterSectionProps) => (
<div className="flex flex-col space-y-1.5">
<label
htmlFor={`${label.toLowerCase()}-filter`}
className="text-sm font-medium text-muted-foreground"
>
{label}
</label>
<Popover>
<PopoverTrigger asChild>
<Button
id={`${label.toLowerCase()}-filter`}
variant="outline"
role="combobox"
className="w-full sm:w-[200px] justify-between"
disabled={disabled}
>
{buttonText}
<ChevronDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
</PopoverTrigger>
{!disabled && (
<PopoverContent className="w-full sm:w-[200px] p-0">
<div className="max-h-[300px] overflow-y-auto">
{options.map((option) => (
<FilterOption
key={option}
id={option}
label={option}
checked={selectedOptions.includes(option)}
onCheckedChange={() => onOptionChange(option)}
capitalize={capitalize}
/>
))}
</div>
</PopoverContent>
)}
</Popover>
</div>
);

interface PullRequestFilterProps {
uniqueRepositories: string[];
Expand Down
50 changes: 23 additions & 27 deletions app/(dashboard)/dashboard/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,30 @@ import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { customerPortalAction } from "@/lib/payments/actions";

const SubscriptionContent = () => {
return (
<div className="space-y-4">
<div className="flex">
<form action={customerPortalAction}>
<Button
type="submit"
className="bg-orange-500 hover:bg-orange-600 text-white border border-orange-600 rounded-full text-lg px-8 py-4 inline-flex items-center justify-center"
>
Manage Subscription
</Button>
</form>
</div>
const SubscriptionContent = () => (
<div className="space-y-4">
<div className="flex">
<form action={customerPortalAction}>
<Button
type="submit"
className="bg-orange-500 hover:bg-orange-600 text-white border border-orange-600 rounded-full text-lg px-8 py-4 inline-flex items-center justify-center"
>
Manage Subscription
</Button>
</form>
</div>
);
};
</div>
);

const SettingsPage = () => {
return (
<Card>
<CardHeader>
<CardTitle className="text-2xl font-bold">Subscription</CardTitle>
</CardHeader>
<CardContent>
<SubscriptionContent />
</CardContent>
</Card>
);
};
const SettingsPage = () => (
<Card>
<CardHeader>
<CardTitle className="text-2xl font-bold">Subscription</CardTitle>
</CardHeader>
<CardContent>
<SubscriptionContent />
</CardContent>
</Card>
);

export default SettingsPage;
68 changes: 33 additions & 35 deletions app/(dashboard)/pricing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,39 +74,37 @@ const PricingCard = ({
trialDays?: number;
features: string[];
priceId?: string;
}) => {
return (
<div className="border rounded-lg p-6 shadow-sm">
<h2 className="text-2xl font-medium text-gray-900 mb-2">{name}</h2>
{trialDays && (
<p className="text-sm text-gray-600 mb-4">
with {trialDays} day free trial
</p>
)}
<p className="text-4xl font-medium text-gray-900 mb-6">
${price / 100}{" "}
<span className="text-xl font-normal text-gray-600">
/user/{interval}
</span>
}) => (
<div className="border rounded-lg p-6 shadow-sm">
<h2 className="text-2xl font-medium text-gray-900 mb-2">{name}</h2>
{trialDays && (
<p className="text-sm text-gray-600 mb-4">
with {trialDays} day free trial
</p>
<ul className="space-y-4 mb-8">
{features.map((feature, index) => (
<li key={index} className="flex items-start">
<Check className="h-5 w-5 text-orange-500 mr-2 mt-0.5 flex-shrink-0" />
<span className="text-gray-700">{feature}</span>
</li>
))}
</ul>
{priceId ? (
<form action={checkoutAction}>
<input type="hidden" name="priceId" value={priceId} />
<SubmitButton />
</form>
) : (
<button className="w-full bg-orange-500 text-white py-2 px-4 rounded-md hover:bg-orange-600 transition-colors">
Get Started
</button>
)}
</div>
);
};
)}
<p className="text-4xl font-medium text-gray-900 mb-6">
${price / 100}{" "}
<span className="text-xl font-normal text-gray-600">
/user/{interval}
</span>
</p>
<ul className="space-y-4 mb-8">
{features.map((feature, index) => (
<li key={index} className="flex items-start">
<Check className="h-5 w-5 text-orange-500 mr-2 mt-0.5 flex-shrink-0" />
<span className="text-gray-700">{feature}</span>
</li>
))}
</ul>
{priceId ? (
<form action={checkoutAction}>
<input type="hidden" name="priceId" value={priceId} />
<SubmitButton />
</form>
) : (
<button className="w-full bg-orange-500 text-white py-2 px-4 rounded-md hover:bg-orange-600 transition-colors">
Get Started
</button>
)}
</div>
);
8 changes: 3 additions & 5 deletions components/ui/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}

const Badge = ({ className, variant, ...props }: BadgeProps) => {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
);
};
const Badge = ({ className, variant, ...props }: BadgeProps) => (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
);

export { Badge, badgeVariants };
40 changes: 18 additions & 22 deletions components/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ Command.displayName = CommandPrimitive.displayName;

interface CommandDialogProps extends DialogProps {}

const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
return (
<Dialog {...props}>
<DialogContent className="overflow-hidden p-0">
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
{children}
</Command>
</DialogContent>
</Dialog>
);
};
const CommandDialog = ({ children, ...props }: CommandDialogProps) => (
<Dialog {...props}>
<DialogContent className="overflow-hidden p-0">
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
{children}
</Command>
</DialogContent>
</Dialog>
);

const CommandInput = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Input>,
Expand Down Expand Up @@ -129,17 +127,15 @@ CommandItem.displayName = CommandPrimitive.Item.displayName;
const CommandShortcut = ({
className,
...props
}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
className={cn(
"ml-auto text-xs tracking-widest text-muted-foreground",
className,
)}
{...props}
/>
);
};
}: React.HTMLAttributes<HTMLSpanElement>) => (
<span
className={cn(
"ml-auto text-xs tracking-widest text-muted-foreground",
className,
)}
{...props}
/>
);
CommandShortcut.displayName = "CommandShortcut";

export {
Expand Down
14 changes: 6 additions & 8 deletions components/ui/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,12 @@ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
const DropdownMenuShortcut = ({
className,
...props
}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
{...props}
/>
);
};
}: React.HTMLAttributes<HTMLSpanElement>) => (
<span
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
{...props}
/>
);
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";

export {
Expand Down
Loading
Loading