Skip to content

Commit

Permalink
Merge branch 'harness:main' into pixel-point-onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgolovanov authored Jan 28, 2025
2 parents 49b61bc + d1b6401 commit fc0bcfa
Show file tree
Hide file tree
Showing 56 changed files with 829 additions and 450 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const RepoViewWrapper: FC<PropsWithChildren<React.HTMLAttributes<HTMLElement>>>
path="*"
element={
<>
<div className="layer-high sticky top-[55px] bg-background-1">
<div className="layer-high bg-background-1 sticky top-[55px]">
<RepoSubheader useTranslationStore={useTranslationsStore} />
</div>
{children}
Expand Down
6 changes: 6 additions & 0 deletions apps/design-system/src/pages/view-preview/view-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { RepoBranchesView } from '@subjects/views/repo-branches'
import { RepoCommitsView } from '@subjects/views/repo-commits'
import { CreateRepoView } from '@subjects/views/repo-create'
import { RepoCreateRule } from '@subjects/views/repo-create-rule'
import { RepoEmpty } from '@subjects/views/repo-empty/repo-empty-view'
import { RepoFilesEditView } from '@subjects/views/repo-files/repo-files-edit-view'
import { RepoFilesJsonView } from '@subjects/views/repo-files/repo-files-json-view'
import { RepoFilesList } from '@subjects/views/repo-files/repo-files-list'
Expand Down Expand Up @@ -62,6 +63,11 @@ export const viewPreviews: Record<string, ReactNode> = {
<RepoSummaryViewWrapper />
</RepoViewWrapper>
),
'repo-empty': (
<RepoViewWrapper>
<RepoEmpty />
</RepoViewWrapper>
),
'repo-list': (
<RootViewWrapper>
<RepoListWrapper />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ const PullRequestConversation: FC<PullRequestConversationProps> = ({ state }) =>
handleSaveComment={noop}
currentUser={{ display_name: currentUserData?.display_name, uid: currentUserData?.uid }}
onCopyClick={noop}
onCommentSaveAndStatusChange={noop}
toggleConversationStatus={noop}
onCommitSuggestion={noop}
addSuggestionToBatch={noop}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,144 @@ export const mockPullRequestActions = [
]

export const mockActivities = [
{
id: 795,
created: 1737660580605,
updated: 1737660580605,
edited: 1737660580605,
parent_id: null,
repo_id: 22,
pullreq_id: 174,
order: 2,
sub_order: 0,
type: 'code-comment',
kind: 'change-comment',
text: 'We should add type checking for this function to improve type safety',
payload: {
title: '@@ -0,0 +1,4 @@',
lines: [
"+import tailwindcssAnimate from 'tailwindcss-animate'",
"+import { PluginAPI } from 'tailwindcss/types/config'",
'+',
'+export default {'
],
line_start_new: true,
line_end_new: true
},
author: {
id: 3,
uid: 'admin',
display_name: 'Administrator',
email: '[email protected]',
type: 'user',
created: 1699863416002,
updated: 1699863416002
},
resolved: 1737660580605,
resolver: {
id: 3,
uid: 'admin',
display_name: 'Administrator',
email: '[email protected]',
type: 'user',
created: 1699863416002,
updated: 1699863416002
},
code_comment: {
outdated: false,
merge_base_sha: '12421f51a7cca90376cba8de0fe9b3289eb6e218',
source_sha: '34f4d7bbfeda153e4965395ac6a20e80dec63e57',
path: 'packages/canary/configs/tailwind.ts',
line_new: 2,
span_new: 1,
line_old: 0,
span_old: 0
}
},
{
id: 796,
created: 1737660580605,
updated: 1737660580605,
edited: 1737660580605,
parent_id: null,
repo_id: 22,
pullreq_id: 174,
order: 2,
sub_order: 0,
type: 'comment',
kind: 'comment',
text: 'Should we consider adding unit tests for the new animation components?',
payload: {},
author: {
id: 3,
uid: 'admin',
display_name: 'Administrator',
email: '[email protected]',
type: 'user',
created: 1699863416002,
updated: 1699863416002
},
resolved: 1737660580607,
resolver: {
id: 3,
uid: 'admin',
display_name: 'Administrator',
email: '[email protected]',
type: 'user',
created: 1699863416002,
updated: 1699863416002
}
},

{
id: 797,
created: 1737660580606,
updated: 1737660580606,
edited: 1737660580606,
parent_id: 796,
repo_id: 22,
pullreq_id: 174,
order: 2,
sub_order: 1,
type: 'comment',
kind: 'comment',
text: 'Yes, I agree. I will add tests for basic animations first.',
payload: {},
author: {
id: 3,
uid: 'admin',
display_name: 'Administrator',
email: '[email protected]',
type: 'user',
created: 1699863416002,
updated: 1699863416002
}
},

{
id: 798,
created: 1737660580607,
updated: 1737660580607,
edited: 1737660580607,
parent_id: 796,
repo_id: 22,
pullreq_id: 174,
order: 2,
sub_order: 2,
type: 'comment',
kind: 'comment',
text: 'Tests have been added in PR #123. We can close this discussion.',
payload: {},
author: {
id: 3,
uid: 'admin',
display_name: 'Administrator',
email: '[email protected]',
type: 'user',
created: 1699863416002,
updated: 1699863416002
}
},
{
id: 792,
created: 1737660563002,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { RepoEmptyView } from '@harnessio/ui/views'

export const RepoEmpty = () => {
return (
<RepoEmptyView
httpUrl="https://github.com/mock-repo"
repoName="mock-repo"
projName="mock-project"
sshUrl="[email protected]:mock-repo.git"
/>
)
}
16 changes: 7 additions & 9 deletions apps/gitness/src/AppMFE.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ export interface MFERouteRendererProps {
onRouteChange: (updatedLocationPathname: string) => void
}

const filteredRoutes = extractRedirectRouteObjects(repoRoutes)
const isRouteMatchingRedirectRoutes = (pathToValidate: string) => {
return filteredRoutes.every(route => !matchPath(`/${route.path}` as string, pathToValidate))
const filteredRedirectRoutes = extractRedirectRouteObjects(repoRoutes)
const isRouteNotMatchingRedirectRoutes = (pathToValidate: string) => {
return filteredRedirectRoutes.every(route => !matchPath(`/${route.path}` as string, pathToValidate))
}

function MFERouteRenderer({ renderUrl, parentLocationPath, onRouteChange }: MFERouteRendererProps) {
const navigate = useNavigate()
const location = useLocation()
const parentPath = parentLocationPath.replace(renderUrl, '')
const isNotRedirectPath = isRouteMatchingRedirectRoutes(location.pathname)
const isNotRedirectPath = isRouteNotMatchingRedirectRoutes(location.pathname)

/**
* renderUrl ==> base URL of parent application
Expand All @@ -50,20 +50,18 @@ function MFERouteRenderer({ renderUrl, parentLocationPath, onRouteChange }: MFER
)

// Handle location change detected from parent route

useEffect(() => {
if (canNavigate) {
const pathToNavigate = parentLocationPath.replace(renderUrl, '')
navigate(pathToNavigate, { replace: true })
navigate(parentPath, { replace: true })
}
}, [parentLocationPath])
}, [parentPath])

// Notify parent about route change
useEffect(() => {
if (canNavigate) {
onRouteChange?.(`${renderUrl}${location.pathname}`)
}
}, [location])
}, [location.pathname])

return null
}
Expand Down
2 changes: 1 addition & 1 deletion apps/gitness/src/components-v2/app-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export const AppShellMFE = () => {
function BreadcrumbsAndOutlet({ className }: { className?: string }) {
return (
<div className={cn('flex flex-col', className)}>
<div className="layer-high bg-background-1 sticky top-0">
<div className="layer-high sticky top-0 bg-background-1">
<Breadcrumbs />
</div>
<Outlet />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,14 @@ export const CreatePullRequest = () => {
}
const { data: { body: branches } = {} } = useListBranchesQuery({
repo_ref: repoRef,
queryParams: { page: 0, limit: 10, query: sourceQuery || targetQuery || '', include_pullreqs: true }
queryParams: {
page: 0,
sort: 'date',
order: 'desc',
limit: 10,
query: sourceQuery || targetQuery || '',
include_pullreqs: true
}
})

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,6 @@ export default function PullRequestConversationPage() {
onCommitSuggestionsBatch,
suggestionsBatch,
suggestionToCommit,
onCommentSaveAndStatusChange,
toggleConversationStatus,
handleUpload
} = usePRCommonInteractions({
Expand Down Expand Up @@ -662,7 +661,6 @@ export default function PullRequestConversationPage() {
handleSaveComment={handleSaveComment}
currentUser={{ display_name: currentUserData?.display_name, uid: currentUserData?.uid }}
onCopyClick={onCopyClick}
onCommentSaveAndStatusChange={onCommentSaveAndStatusChange}
toggleConversationStatus={toggleConversationStatus}
onCommitSuggestion={onCommitSuggestion}
addSuggestionToBatch={addSuggestionToBatch}
Expand Down
4 changes: 3 additions & 1 deletion apps/gitness/src/pages-v2/repo/repo-create-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export const CreateRepo = () => {

createRepositoryMutation.mutate(
{
queryParams: {},
queryParams: {
space_path: spaceURL
},
body: repositoryRequest
},
{
Expand Down
2 changes: 1 addition & 1 deletion apps/gitness/src/pages-v2/repo/repo-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function ReposListPage() {
space_ref: `${spaceURL}/+`
},
{
retry: false
retry: 5
}
)

Expand Down
2 changes: 1 addition & 1 deletion apps/gitness/src/pages-v2/repo/repo-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const RepoSidebar = () => {
queryParams: {
include_commit: false,
sort: 'date',
order: orderSortDate.ASC,
order: orderSortDate.DESC,
limit: 50,
query: searchQuery
}
Expand Down
2 changes: 1 addition & 1 deletion apps/gitness/src/pages-v2/repo/repo-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function RepoSummaryPage() {

const { data: { body: branches } = {} } = useListBranchesQuery({
repo_ref: repoRef,
queryParams: { include_commit: false, sort: 'date', order: orderSortDate.ASC, limit: 50, query: branchTagQuery }
queryParams: { include_commit: false, sort: 'date', order: orderSortDate.DESC, limit: 50, query: branchTagQuery }
})

const { data: { body: branchDivergence = [] } = {}, mutate: calculateDivergence } =
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/locales/en/views.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
"noCommitsYet": "No commits yet",
"noCommitsYetDescription": "Your commits will appear here once they're made. Start committing to see your changes reflected.",
"compareChanges": "Compare and review just about anything",
"compareChangesDescription": "Branches, tags, commit ranges, and time ranges. In the same repository and across forks.",
"compareChangesDescription": "Branches and commit ranges can be reviewed within the same repository.",
"clearFilters": "Clear filters",
"noPullRequests": "There are no pull requests in this project yet.",
"createNewPullRequest": "Create a new pull request.",
Expand Down Expand Up @@ -231,7 +231,7 @@
"compareChangesCantMergeDesciption": "You can still create the pull request.",
"compareChangesDiscussChanges": "Discuss and review the changes in this comparison with others.",
"compareChangesDiscussChangesLink": "Learn about pull requests.",
"compareChangesChooseDifferent": "Choose different branches or forks above to discuss and review changes.",
"compareChangesChooseDifferent": "Choose different branches above to discuss and review changes.",
"compareChangesViewPRLink": "View pull request",
"compareChangesTabOverview": "Overview",
"compareChangesTabCommits": "Commits",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const badgeVariants = cva(
lg: 'px-3 py-1 text-xs font-normal',
md: 'h-6 px-2.5',
sm: 'h-5 px-1.5 text-12',
xs: 'px-1.5 py-0 text-11 font-light'
xs: 'h-[18px] px-1.5 text-11 font-light'
},
borderRadius: {
default: 'rounded-md',
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { cn } from '@utils/cn'
import { cva, type VariantProps } from 'class-variance-authority'

const buttonVariants = cva(
'inline-flex items-center justify-center whitespace-nowrap rounded text-sm font-medium transition-colors disabled:pointer-events-none disabled:cursor-not-allowed',
'inline-flex items-center justify-center whitespace-nowrap rounded text-14 font-medium transition-colors disabled:pointer-events-none disabled:cursor-not-allowed',
{
variants: {
variant: {
Expand Down
10 changes: 9 additions & 1 deletion packages/ui/src/components/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import AppleShortcut from '../icons/apple-shortcut.svg'
import ArrowLong from '../icons/arrow-long.svg'
import ArtifactsGradient from '../icons/artifacts-gradient.svg'
import Artifacts from '../icons/artifacts-icon.svg'
import AttachmentImage from '../icons/attachment-image.svg'
import Attachment from '../icons/attachment.svg'
import BitrisePlugin from '../icons/bitrise-plugin.svg'
import Bold from '../icons/bold.svg'
Expand Down Expand Up @@ -45,6 +46,7 @@ import CloudCosts from '../icons/cloud-costs-icon.svg'
import CodeBrackets from '../icons/code-brackets.svg'
import Code from '../icons/code.svg'
import Cog6 from '../icons/cog-6.svg'
import CollapseComment from '../icons/collapse-comment.svg'
import CollapseDiff from '../icons/collapse-diff.svg'
import Comments from '../icons/comments.svg'
import Compare from '../icons/compare.svg'
Expand All @@ -67,6 +69,7 @@ import Edit from '../icons/edit-icon.svg'
import Environment from '../icons/environment-icon.svg'
import ExecutionGradient from '../icons/execution-gradient.svg'
import Execution from '../icons/execution-icon.svg'
import ExpandComment from '../icons/expand-comment.svg'
import ExpandDiff from '../icons/expand-diff.svg'
import Eye from '../icons/eye-icon.svg'
import Fail from '../icons/fail.svg'
Expand Down Expand Up @@ -159,6 +162,7 @@ import Stack from '../icons/stack-icon.svg'
import Star from '../icons/star-icon.svg'
import SubMenuEllipse from '../icons/sub-menu-ellipse.svg'
import Success from '../icons/success.svg'
import Suggestion from '../icons/suggestion.svg'
import SupplyChainGradient from '../icons/supply-chain-gradient.svg'
import SupplyChain from '../icons/supply-chain-icon.svg'
import Tag from '../icons/tag.svg'
Expand Down Expand Up @@ -359,7 +363,11 @@ const IconNameMap = {
'collapse-diff': CollapseDiff,
'expand-diff': ExpandDiff,
'circle-plus': CirclePlus,
'code-brackets': CodeBrackets
'code-brackets': CodeBrackets,
'attachment-image': AttachmentImage,
'collapse-comment': CollapseComment,
'expand-comment': ExpandComment,
suggestion: Suggestion
} satisfies Record<string, React.FunctionComponent<React.SVGProps<SVGSVGElement>>>

export interface IconProps {
Expand Down
Loading

0 comments on commit fc0bcfa

Please sign in to comment.