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

feat: Leetcode Company Tagged 🗂️ #530

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
33 changes: 33 additions & 0 deletions apps/member-profile/app/routes/_profile.companies_.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
'companies.imageUrl',
'companies.name',
'companies.levelsFyiSlug',
'companies.leetcodeTagged',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we're changing the name to leetcodeTaggedSlug in the database, we need to have that changed reflected here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

],
where: { id },
}),
Expand Down Expand Up @@ -154,6 +155,10 @@ export default function CompanyPage() {
{company.levelsFyiSlug && (
<LevelsFyiLink slug={company.levelsFyiSlug} />
)}

{company.leetcodeTagged && (
<LeetcodeTaggedLink leetcode_tagged={company.leetcodeTagged} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's change the naming from leetcode_tagged to slug, so we can have consistency with the pattern used for the Levels.fyi link as well

)}
</div>

<DomainLink domain={company.domain} />
Expand Down Expand Up @@ -216,6 +221,34 @@ function LevelsFyiLink({ slug }: LevelsFyiLinkProps) {
);
}

type LeetcodeTaggedLinkProps = {
leetcode_tagged: string;
};

function LeetcodeTaggedLink({ leetcode_tagged }: LeetcodeTaggedLinkProps) {
return (
<Tooltip>
<TooltipTrigger asChild>
<a
className="mt-1"
href={leetcode_tagged}
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Leetcode Logo"
className="h-4 w-4 cursor-pointer rounded-sm hover:opacity-90"
src="/images/leetcode.png"
/>
</a>
</TooltipTrigger>
<TooltipContent>
<TooltipText>View Company Leetcode Problems</TooltipText>
</TooltipContent>
</Tooltip>
);
}

function AverageRating({
averageRating,
}: Pick<CompanyInView, 'averageRating'>) {
Expand Down
Binary file added apps/member-profile/public/images/leetcode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { type Kysely } from 'kysely';

export async function up(db: Kysely<any>) {
await db.schema
.alterTable('companies')
.addColumn('leetcode_tagged', 'varchar')
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's change leetcode_tagged to leetcode_tagged_slug to follow the pattern that's used with levels_fyi_slug

.execute();
}

export async function down(db: Kysely<any>) {
await db.schema
.alterTable('companies')
.dropColumn('leetcode_tagged')
.execute();
}