Skip to content

Commit

Permalink
feat: compare mode open new tabs (#259)
Browse files Browse the repository at this point in the history
Signed-off-by: laixingyou <[email protected]>
  • Loading branch information
coder-sett authored Nov 2, 2023
1 parent 20243bd commit 0f1322c
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ const RepoItem: React.FC<{

return (
<div className="rounded border border-gray-300 px-4 py-3">
<Link
href={getShortAnalyzeLink(shortCode)}
target="_blank"
className="hover:underline"
>
<Link href={getShortAnalyzeLink(shortCode)} className="hover:underline">
<h4 className="line-clamp-2 text-sm font-bold">{name}</h4>
</Link>
<p className="text-xs text-gray-400">{getFirstPathSegment(path)}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,7 @@ const TrendsList: React.FC = () => {
return (
<tr className="group" key={item!.label}>
<td className="flex flex-col px-1 py-2 ">
<Link
href={getShortAnalyzeLink(item!.shortCode)}
target="_blank"
>
<Link href={getShortAnalyzeLink(item!.shortCode)}>
<p className="break-words text-sm font-bold md:w-[140px]">
{r.name}
{item?.level === Level.COMMUNITY ? (
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/modules/collection/MainHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const MainHeader = ({
<div
onClick={async () => {
if (compareIds.length > 1) {
await router.push(getShortCompareLink(compareIds));
await window.open(getShortCompareLink(compareIds), '_blank');
}
// setSelect(false);
}}
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/modules/explore/CollectionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const CollectionCard = (props: { collection: Collection }) => {
<Link
key={label}
href={getShortAnalyzeLink(shortCode)}
target="_blank"
className="flex w-full items-center text-sm hover:underline"
>
<span className="mr-1 h-1 w-1 flex-shrink-0 bg-black" />
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/modules/explore/CollectionFullCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const CollectionFullCard = (props: { collection: Collection }) => {
<Link
key={label}
href={getShortAnalyzeLink(shortCode)}
target="_blank"
className="flex w-full items-center text-sm hover:underline"
>
<span className="mr-1 h-1 w-1 flex-shrink-0 bg-black" />
Expand Down
4 changes: 1 addition & 3 deletions apps/web/src/modules/explore/RepoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ const RepoCard = (props: {
{compareMode ? (
repo
) : (
<Link href={getShortAnalyzeLink(shortCode)} target="_blank">
{repo}
</Link>
<Link href={getShortAnalyzeLink(shortCode)}>{repo}</Link>
)}
</p>
<p className="h-6 truncate text-sm text-gray-400">{nameSpace}</p>
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/modules/home/Banner/SearchDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import Link from 'next/link';
import classnames from 'classnames';
import { useRouter } from 'next/router';
import { useTranslation, Trans } from 'next-i18next';
import { AiOutlineRightCircle } from 'react-icons/ai';
import useDropDown from '@common/hooks/useDropDown';
Expand Down Expand Up @@ -93,7 +94,6 @@ const LinkItem: React.FC<{
<Link
key={item.label}
href={getShortAnalyzeLink(item)}
target="_blank"
className={classnames(
'flex min-h-[66px] cursor-pointer items-center justify-between px-4 py-3 text-xl hover:bg-gray-100',
'md:py-2 md:px-2 md:text-base',
Expand All @@ -115,11 +115,12 @@ const DropDownList: React.FC<{ result: SearchQuery['fuzzySearch'] }> = ({
result,
}) => {
const { t } = useTranslation();
const router = useRouter();
const { active } = useDropDown({
totalLength: result.length,
onPressEnter: () => {
const activeItem = result[active];
window.open(getShortAnalyzeLink(activeItem), '_blank');
router.push(getShortAnalyzeLink(activeItem));
},
});

Expand Down
1 change: 0 additions & 1 deletion apps/web/src/modules/home/HotFields/ProjectItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const ProjectItem = ({ shortCode, url }) => {
<Link
key={name}
href={getShortAnalyzeLink(shortCode)}
target="_blank"
className="flex cursor-pointer justify-between py-1"
>
<div className="text-sm text-black">
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/modules/home/Trending/ListPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const ListPanel = (props: {
key={item.label}
href={getShortAnalyzeLink(item.shortCode)}
className="grid cursor-pointer grid-cols-6 gap-2 border-b py-3 last:border-0"
target="_blank"
>
<div className="col-span-3 flex">
<div className="relative h-10 w-10">
Expand Down

2 comments on commit 0f1322c

@vercel
Copy link

@vercel vercel bot commented on 0f1322c Nov 2, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 0f1322c Nov 2, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.