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

[view] 커밋 링크 추가 #668

Merged
merged 1 commit into from
Aug 27, 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
2 changes: 1 addition & 1 deletion packages/view/src/components/Detail/Detail.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
width: 6em;
position: relative;

span:hover {
a:hover {
cursor: pointer;
.commit-id__tooltip {
display: inline-block;
Expand Down
9 changes: 5 additions & 4 deletions packages/view/src/components/Detail/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { FIRST_SHOW_NUM } from "./Detail.const";
import type { DetailProps, DetailSummaryProps, DetailSummaryItem } from "./Detail.type";

import "./Detail.scss";
import { useGlobalData } from "hooks";

const DetailSummary = ({ commitNodeListInCluster }: DetailSummaryProps) => {
const { authorLength, fileLength, commitLength, insertions, deletions } = getCommitListDetail({
Expand Down Expand Up @@ -49,11 +50,11 @@ const Detail = ({ selectedData, clusterId, authSrcMap }: DetailProps) => {
const commitNodeListInCluster =
selectedData?.filter((selected) => selected.commitNodeList[0].clusterId === clusterId)[0].commitNodeList ?? [];
const { commitNodeList, toggle, handleToggle } = useCommitListHide(commitNodeListInCluster);
const { repo, owner } = useGlobalData();
const isShow = commitNodeListInCluster.length > FIRST_SHOW_NUM;
const handleCommitIdCopy = (id: string) => async () => {
navigator.clipboard.writeText(id);
};

if (!selectedData) return null;

return (
Expand Down Expand Up @@ -84,15 +85,15 @@ const Detail = ({ selectedData, clusterId, authSrcMap }: DetailProps) => {
</span>
</div>
<div className="commit-id">
<span
<a
href={`https://github.com/${owner}/${repo}/commit/${id}`}
Copy link
Contributor

Choose a reason for hiding this comment

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

해당 기능에 추가로, github.com 외의 도메인도 지원하게 하자는 #465 이슈도 추후에 고려해주셨으면 좋겠습니다~~
(enterprise github등을 쓰는 경우에는 github.com 이 아닌 다른 도메인도 쓰인답니다!)

onClick={handleCommitIdCopy(id)}
role="button"
tabIndex={0}
onKeyDown={handleCommitIdCopy(id)}
Copy link
Contributor

Choose a reason for hiding this comment

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

onkeydown 은 저도 왜 있는지 모르겠네요 ^^;;

>
{id.slice(0, 6)}
<span className="commit-id__tooltip">{id}</span>
</span>
</a>
</div>
</li>
);
Expand Down
Loading