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

{company.leetcodeTaggedSlug && (
<LeetcodeTaggedLink slug={company.leetcodeTaggedSlug} />
)}
</div>

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

type LeetcodeTaggedLinkProps = {
slug: string;
};

function LeetcodeTaggedLink({ slug }: LeetcodeTaggedLinkProps) {
return (
<Tooltip>
<TooltipTrigger asChild>
<a
className="mt-1"
href={slug}
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_slug', 'varchar')
.execute();
}

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