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

Revamping landingpage #74

Merged
merged 5 commits into from
Dec 1, 2024
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
21 changes: 8 additions & 13 deletions .github/workflows/format-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }} # Checkout the PR branch
Comment on lines +23 to +24
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Enhance security by using environment variable for branch reference

The direct use of github.head_ref in scripts can be a security risk. It's recommended to pass it through an environment variable.

Apply this diff to improve security:

- ref: ${{ github.head_ref }}  # Checkout the PR branch
+ ref: ${{ github.event.pull_request.head.ref }}

Also, add input sanitization:

- name: Validate branch name
  run: |
    BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
    if [[ ! $BRANCH_NAME =~ ^(feat|bugfix)/.+ || $BRANCH_NAME == "main" ]]; then
      echo "Invalid branch name: $BRANCH_NAME"
      exit 1
    fi


- uses: pnpm/action-setup@v4
name: Install pnpm
Expand All @@ -41,27 +43,20 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-

- name: Install dependencies
run: pnpm install
- name: Install dependencies & turbo
run: pnpm install && pnpm i -g turbo

- name: Check formatting with Prettier
id: format_check
run: |
if pnpm format:check; then
echo "Formatting is correct"
else
echo "Formatting required"
echo "formatting_required=true" >> $GITHUB_ENV
fi
- name: Format code with Prettier
run: turbo format:write

- name: Check for changes and push if needed
run: |
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "chore: format code with Prettier"
git push
git commit -m "format: make the code prettier"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use conventional commit message format

The current commit message "format: make the code prettier" is less descriptive and doesn't follow the conventional commits specification properly.

Apply this diff to improve the commit message:

- git commit -m "format: make the code prettier"
+ git commit -m "style: format code with prettier"

This follows the Conventional Commits specification better by:

  1. Using "style" type for formatting changes
  2. Being more specific about the tool used
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
git commit -m "format: make the code prettier"
git commit -m "style: format code with prettier"

git push origin ${{ github.head_ref }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Secure the git push command

Similar to the checkout step, using github.head_ref directly in the push command is a security risk.

Apply this diff to improve security:

- git push origin ${{ github.head_ref }}
+ git push origin "$SAFE_BRANCH_NAME"

Add this before the push command:

SAFE_BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
if [[ ! $SAFE_BRANCH_NAME =~ ^(feat|bugfix)/.+ || $SAFE_BRANCH_NAME == "main" ]]; then
  echo "Invalid branch name for push: $SAFE_BRANCH_NAME"
  exit 1
fi

else
echo "No formatting changes to push."
fi
2 changes: 1 addition & 1 deletion apps/api/app/api/[[...route]]/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ app.use(
exposeHeaders: ["Content-Length"],
maxAge: 600,
credentials: true,
})
}),
);
app.get("/*", (c) => auth.handler(c.req.raw));
app.post("/*", (c) => auth.handler(c.req.raw));
Expand Down
37 changes: 20 additions & 17 deletions apps/api/app/api/[[...route]]/user.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Hono } from "hono";
import { prisma } from "@repo/db";
import {auth} from "@repo/auth"

import { auth } from "@repo/auth";

const app = new Hono()
.get("/self", async (c) => {
Expand All @@ -10,10 +9,13 @@ const app = new Hono()
});

if (!currentUser) {
return c.json({
message: "Not logged in",
status: 400,
},400);
return c.json(
{
message: "Not logged in",
status: 400,
},
400,
);
}

const user = await prisma.user.findUnique({
Expand All @@ -25,32 +27,34 @@ const app = new Hono()
{
user,
},
200
200,
);
})
.get("/all", async (c) => {
const cursor = c.req.query("cursor");
const take = c.req.query("take");
if (!c.req.url.includes("?cursor=")) {
return c.redirect("?cursor=");
return c.redirect("?cursor=");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

⚠️ Potential issue

Pagination implementation needs revision for better reliability and standards compliance

The code inspection confirms the concerns raised in the review comment. The current implementation has several issues:

  1. The redirect on missing cursor (?cursor=) is indeed problematic as:

    • It's not RESTful - APIs should return proper status codes and error messages
    • It could cause infinite redirects if not handled properly by clients
    • It makes the cursor parameter mandatory when it should be optional for initial page fetch
  2. The skip: 1 is arbitrary and breaks cursor-based pagination:

    • With cursor-based pagination, skip shouldn't be used as the cursor itself handles the offset
    • Skipping the first record on every request will lead to missing data
  3. The take parameter lacks validation and proper defaults:

    • No bounds checking could lead to performance issues
    • Silent fallback to 10 without validation

The suggested improvements in the review comment are valid and would make the implementation more robust and standards-compliant.

🔗 Analysis chain

Review and revise the pagination implementation

Several concerns with the current implementation:

  1. Redirecting on missing cursor parameter is unusual for a REST API
  2. Hardcoded skip: 1 seems arbitrary and could cause issues
  3. The take parameter parsing lacks validation

Consider this improved implementation:

-    if (!c.req.url.includes("?cursor=")) {
-      return c.redirect("?cursor=");
-    }
+    const take = parseInt(take!) || 10;
+    if (isNaN(take) || take < 1 || take > 100) {
+      return c.json(
+        { message: "Invalid take parameter. Must be between 1 and 100", status: 400 },
+        400
+      );
+    }

     const users = await prisma.user.findMany({
-      take: parseInt(take!) || 10,
-      skip: 1,
+      take: take,
       cursor: cursor
         ? {
             id: cursor,
           }
         : undefined,
     });

Let's verify the usage of this endpoint:

Also applies to: 43-47

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for calls to this endpoint to understand pagination usage
rg -l "\/api\/.*\/user\/all" --type ts

Length of output: 127


Script:

#!/bin/bash
# Search for API calls to user/all endpoint with proper escaping
rg -l "/api/.*/user/all" --type ts

# Search for any references to this endpoint pattern
rg -l "user/all" --type ts

# Look for fetch/axios calls that might be using this endpoint
ast-grep --pattern 'fetch($$$"/user/all"$$$)'
ast-grep --pattern 'axios.$_($$$"/user/all"$$$)'

Length of output: 162


Script:

#!/bin/bash
# Let's examine the route handler file content to understand the full context
cat "apps/api/app/api/[[...route]]/user.ts"

# Look for any pagination-related patterns in the codebase
rg "findMany.*take.*skip" --type ts -A 2

# Check for other similar route handlers that might use pagination
fd "route" -e ts -x cat {} 

Length of output: 2550

}

const users = await prisma.user.findMany({
take: parseInt(take!) || 10,
skip: 1,
cursor: cursor ? {
id: cursor,
} :undefined
cursor: cursor
? {
id: cursor,
}
: undefined,
});

const nextCursor = users.length > 0 ? users[users.length - 1].id : null;

return c.json(
{
nextCursor,
users
users,
},
200
200,
);
})
.get("/:id", async (c) => {
Expand All @@ -70,9 +74,8 @@ const app = new Hono()
{
user,
},
200
200,
);
});


export default app;
export default app;
4 changes: 2 additions & 2 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"@hono/zod-validator": "^0.4.1",
"@prisma/client": "^5.22.0",
"@repo/auth": "workspace:*",
"@repo/cache": "workspace:*",
"@repo/db": "workspace:*",
"@repo/mail": "workspace:*",
"@repo/types": "workspace:*",
"@repo/cache": "workspace:*",
"hono": "^4.6.9",
"next": "15.0.2",
"next": "15.0.3",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Next.js version inconsistency detected in root package.json

The root package.json is using Next.js version 15.0.2 while all applications (apps/www, apps/status, apps/api, apps/app) are using version 15.0.3. This inconsistency should be addressed to maintain version alignment across the monorepo.

  • package.json: version 15.0.2
  • All apps: version 15.0.3
🔗 Analysis chain

Verify Next.js update compatibility

The Next.js update from 15.0.2 to 15.0.3 is part of a coordinated update across multiple applications.

Let's verify the version consistency across the monorepo:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check Next.js versions across all package.json files
fd package.json | xargs rg '"next":' -A 1

Length of output: 519

"prisma": "^5.22.0",
"react": "19.0.0-rc-02c0e824-20241028",
"react-dom": "19.0.0-rc-02c0e824-20241028",
Expand Down
5 changes: 3 additions & 2 deletions apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"lint:fix": "next lint --fix",
"typecheck": "tsc --noEmit",
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache"
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache",
"react-scan": "pnpm dlx react-scan@latest http://localhost:3002"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider pinning the react-scan version for stability

Using @latest tag can lead to unexpected behavior if the tool introduces breaking changes. Consider pinning to a specific version for consistency across builds.

-    "react-scan": "pnpm dlx react-scan@latest http://localhost:3002"
+    "react-scan": "pnpm dlx react-scan@1.0.0 http://localhost:3002"

Committable suggestion skipped: line range outside the PR's diff.

},
"dependencies": {
"@better-fetch/fetch": "^1.1.12",
Expand Down Expand Up @@ -43,7 +44,7 @@
"geist": "^1.3.1",
"input-otp": "^1.4.1",
"lucide-react": "^0.454.0",
"next": "15.0.2",
"next": "15.0.3",
"next-themes": "^0.4.3",
"react": "19.0.0-rc-02c0e824-20241028",
"react-beautiful-dnd": "^13.1.1",
Expand Down
3 changes: 2 additions & 1 deletion apps/status/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "next dev -p 3004 --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"react-scan": "pnpm dlx react-scan@latest http://localhost:3004"
},
"dependencies": {
"@radix-ui/react-accordion": "^1.2.1",
Expand Down
123 changes: 65 additions & 58 deletions apps/www/app/(routes)/contact/page.tsx
Original file line number Diff line number Diff line change
@@ -1,76 +1,83 @@
import { SectionHeader, SectionHeaderDescription, SectionHeaderHeading } from "@/components/custom/text-wrappers";
import {
SectionHeader,
SectionHeaderDescription,
SectionHeaderHeading,
} from "@/components/custom/text-wrappers";
import {
Card,
CardContent,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
} from "@/components/ui/card";

import React from "react";

export default function Contact() {
return (
<section className="flex flex-col h-full w-full">
<section className="flex flex-col h-full w-full">
<div className="absolute inset-0 mx-auto h-full w-full bg-[radial-gradient(circle,rgba(211,211,211,0.1),rgba(18,20,22,0.05),rgba(18,20,22,0))] opacity-60" />
<div className="px-8 md:px-12">
<div className="flex md:flex-row">
<SectionHeader className="flex flex-col max-w-2xl">
<SectionHeaderHeading>
Contact support
</SectionHeaderHeading>
<SectionHeaderDescription>
We are here to help. Ask product questions, report problems, or leave feedback.
</SectionHeaderDescription>
</SectionHeader>

<Card className="w-3/6 m-10">
Ok beb
</Card>

</div>
<section className="w-full border-t-2 border-dashed py-20">
<div className="grid grid-cols-1 md:grid-cols-3 px-8 md:px-20">

<Card className="border-none">
<CardHeader>
<CardTitle className="text-xl">Join the community</CardTitle>
</CardHeader>
<CardContent className="text-sm text-muted-foreground">
<p>More than 10,000 Linear users share questions and best practices in our Slack community.</p>
</CardContent>
<CardFooter>
<p>Card Footer</p>
</CardFooter>
</Card>
<div className="px-8 md:px-12">
<div className="flex md:flex-row">
<SectionHeader className="flex flex-col max-w-2xl">
<SectionHeaderHeading>Contact support</SectionHeaderHeading>
<SectionHeaderDescription>
We are here to help. Ask product questions, report problems, or
leave feedback.
</SectionHeaderDescription>
</SectionHeader>

<Card className="border-none">
<CardHeader>
<CardTitle className="text-xl">Join the community</CardTitle>
</CardHeader>
<CardContent className="text-sm text-muted-foreground">
<p>More than 10,000 Linear users share questions and best practices in our Slack community.</p>
</CardContent>
<CardFooter>
<p>Card Footer</p>
</CardFooter>
</Card>
<Card className="w-3/6 m-10">Ok beb</Card>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Replace placeholder card content

The card contains placeholder text "Ok beb" which should be replaced with meaningful content appropriate for a contact page.

Consider adding a contact form or relevant contact information. Example structure:

-<Card className="w-3/6 m-10">Ok beb</Card>
+<Card className="w-3/6 m-10">
+  <CardHeader>
+    <CardTitle>Get in Touch</CardTitle>
+  </CardHeader>
+  <CardContent>
+    {/* Add contact form or contact information here */}
+  </CardContent>
+</Card>

Committable suggestion skipped: line range outside the PR's diff.

</div>
<section className="w-full border-t-2 border-dashed py-20">
<div className="grid grid-cols-1 md:grid-cols-3 px-8 md:px-20">
<Card className="border-none">
<CardHeader>
<CardTitle className="text-xl">Join the community</CardTitle>
</CardHeader>
<CardContent className="text-sm text-muted-foreground">
<p>
More than 10,000 Linear users share questions and best
practices in our Slack community.
Comment on lines +40 to +41
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update card content to match your product

The cards reference "Linear users", which appears to be copied content from another product. Update the content to be relevant to your product and users.

Also applies to: 55-56, 70-71

</p>
</CardContent>
<CardFooter>
<p>Card Footer</p>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Replace footer placeholder text

All cards contain placeholder text "Card Footer". Replace with meaningful content such as action buttons, links, or relevant information.

Also applies to: 60-60, 75-75

</CardFooter>
</Card>

<Card className="border-none">
<CardHeader>
<CardTitle className="text-xl">Join the community</CardTitle>
</CardHeader>
<CardContent className="text-sm text-muted-foreground">
<p>More than 10,000 Linear users share questions and best practices in our Slack community.</p>
</CardContent>
<CardFooter>
<p>Card Footer</p>
</CardFooter>
</Card>
<Card className="border-none">
<CardHeader>
<CardTitle className="text-xl">Join the community</CardTitle>
</CardHeader>
<CardContent className="text-sm text-muted-foreground">
<p>
More than 10,000 Linear users share questions and best
practices in our Slack community.
</p>
</CardContent>
<CardFooter>
<p>Card Footer</p>
</CardFooter>
</Card>

<Card className="border-none">
<CardHeader>
<CardTitle className="text-xl">Join the community</CardTitle>
</CardHeader>
<CardContent className="text-sm text-muted-foreground">
<p>
More than 10,000 Linear users share questions and best
practices in our Slack community.
</p>
</CardContent>
<CardFooter>
<p>Card Footer</p>
</CardFooter>
</Card>
</div>
Comment on lines +33 to +78
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Refactor duplicate card components

The three cards are identical in structure and content, which violates the DRY principle. Consider creating a reusable component and mapping over an array of data.

Here's a suggested refactor:

type ContactCardProps = {
  title: string;
  description: string;
  footer: string;
};

const ContactCard = ({ title, description, footer }: ContactCardProps) => (
  <Card className="border-none">
    <CardHeader>
      <CardTitle className="text-xl">{title}</CardTitle>
    </CardHeader>
    <CardContent className="text-sm text-muted-foreground">
      <p>{description}</p>
    </CardContent>
    <CardFooter>
      <p>{footer}</p>
    </CardFooter>
  </Card>
);

// Usage:
const cardData = [
  {
    title: "Join the community",
    description: "More than 10,000 Linear users share questions and best practices in our Slack community.",
    footer: "Card Footer"
  },
  // ... add data for other cards
];

<div className="grid grid-cols-1 md:grid-cols-3 px-8 md:px-20">
  {cardData.map((data, index) => (
    <ContactCard key={index} {...data} />
  ))}
</div>

</section>
</div>
</section>
</div>
</section>
);
);
}
8 changes: 2 additions & 6 deletions apps/www/app/(routes)/features/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import React from 'react'
import React from "react";

export default function Features() {
return (
<div>
Fuck
</div>
)
return <div>Fuck</div>;
}
1 change: 0 additions & 1 deletion apps/www/app/(routes)/integrations/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ import React from "react";
export default function Integrations() {
return <div>integrations</div>;
}

8 changes: 2 additions & 6 deletions apps/www/app/(routes)/methods/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import React from 'react'
import React from "react";

export default function Methods() {
return (
<div>
Fuck
</div>
)
return <div>Fuck</div>;
}
Loading