Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ankormoreankor committed Feb 4, 2025
1 parent 4990128 commit be10617
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,6 @@ const PullRequestConversation: FC<PullRequestConversationProps> = ({ state }) =>
setSearchLabelQuery={noop}
addLabel={noop}
removeLabel={noop}
addLabelError={undefined}
removeLabelError={undefined}
useTranslationStore={useTranslationStore}
/>
</SandboxLayout.Content>
Expand Down
6 changes: 4 additions & 2 deletions apps/gitness/src/framework/context/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const AppContext = createContext<AppContextType>({
export const AppProvider: FC<{ children: ReactNode }> = ({ children }) => {
usePageTitle()
const [spaces, setSpaces] = useState<TypesSpace[]>([])
const [isSpacesLoading, setSpacesIsLoading] = useState<boolean>(false)
const [isSpacesLoading, setSpacesIsLoading] = useState(false)
const [currentUser, setCurrentUser] = useLocalStorage<TypesUser>('currentUser', {})
const [isLoadingUser, setIsLoadingUser] = useState(false)
const [isUpdatingUser, setIsUpdatingUser] = useState(false)
Expand Down Expand Up @@ -106,12 +106,14 @@ export const AppProvider: FC<{ children: ReactNode }> = ({ children }) => {

if (membershipResult.status === 'fulfilled') {
setSpaces(membershipResult.value.body.filter(item => item?.space).map(item => item.space as TypesSpace))
setSpacesIsLoading(false)
}
})
.catch(() => {
// Optionally handle error or show toast
})
.finally(() => {
setSpacesIsLoading(false)
})
}, [])

const addSpaces = (newSpaces: TypesSpace[]): void => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export const ProjectGeneralSettingsPageContainer = () => {
}
)

const handleFormSubmit = (formdata: ProjectSettingsGeneralFields) => {
updateDescription.mutate({ space_ref: space?.path, body: { description: formdata?.description } })
const handleFormSubmit = (formData: ProjectSettingsGeneralFields) => {
updateDescription.mutate({ space_ref: space?.path, body: { description: formData?.description } })
}

// delete API call here
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/alert/AlertContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const AlertContainer = forwardRef<HTMLDivElement, AlertContainerProps>(
{closable && (
<button
type="button"
className="absolute top-2 right-2 text-gray-400 hover:text-gray-500"
className="absolute right-2 top-2 text-gray-400 hover:text-gray-500"
onClick={() => setIsVisible(false)}
>
<Icon name="close" size={16} />
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/components/form-primitives/legend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ interface LegendProps {
export function Legend({ title, description, className, children }: PropsWithChildren<LegendProps>) {
return (
<section className={cn('grid gap-y-2.5', className)}>
<h6 className="text-foreground-1 text-18 font-medium leading-tight">{title}</h6>
<h6 className="text-18 font-medium leading-tight text-foreground-1">{title}</h6>

{description && <p className="text-foreground-2 text-sm">{description}</p>}
{description && <p className="text-sm text-foreground-2">{description}</p>}

{children}
</section>
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/views/execution/console-logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ const ConsoleLogs: FC<ConsoleLogsProps> = ({ logs, query }) => {
<div className="mb-2 flex items-baseline justify-between leading-[21px]" key={index}>
<div className="flex items-baseline gap-2">
{pos !== undefined && !isNaN(pos) && pos >= 0 && (
<Text className="flex min-w-5 justify-end text-log">{pos}</Text>
<Text className="text-log flex min-w-5 justify-end">{pos}</Text>
)}
{time ? (
<Text className="flex text-sm font-normal text-log">[{formatTimestamp(time * 1_000)}]</Text>
<Text className="text-log flex text-sm font-normal">[{formatTimestamp(time * 1_000)}]</Text>
) : null}
{out ? logText(out) : null}
</div>
<Text className="mr-2 text-sm font-normal text-log">
<Text className="text-log mr-2 text-sm font-normal">
{formatDuration(duration && duration > 0 ? duration * 1_000 : 0)}
</Text>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/views/execution/execution-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const ExecutionHeader: React.FC<ExecutionHeaderProps> = ({
<span className="text-primary">{title.title}</span>
</Text>
</div>
<div className="flex items-end gap-12 h-full">
<div className="flex h-full items-end gap-12">
<div className="flex flex-col">
<span className="text-foreground-5">Storage</span>
<span className="text-primary">{storage}</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/views/execution/execution-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Badge: React.FC<ExecutionStatusProps & BadgeProps> = props => {
case ExecutionState.RUNNING:
return minimal ? (
<div className="flex items-center gap-1">
<div className="size-2 rounded-full bg-studio-3" />
<div className="bg-studio-3 size-2 rounded-full" />
<span className="text-studio-3">Running</span>
</div>
) : (
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/views/execution/key-value-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export const KeyValueTable: React.FC<KeyValueTableProps> = ({
if (typeof item.value === 'string') {
return (
<ul className="flex flex-row border-b align-middle" key={index}>
<li className="w-1/2 py-2.5 pr-2.5 text-studio-7" style={{ paddingLeft: `${level + 1}rem` }}>
<li className="text-studio-7 w-1/2 py-2.5 pr-2.5" style={{ paddingLeft: `${level + 1}rem` }}>
<Text size={2} weight="normal">
{item.name}
</Text>
</li>
<li className="w-1/2 py-2.5 pl-1.5 pr-2.5 text-studio-7">
<li className="text-studio-7 w-1/2 py-2.5 pl-1.5 pr-2.5">
<Text size={2} weight="normal">
{item.value}
</Text>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/views/execution/pipeline-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const PipelineStatus = ({
createdTime: string
}) => {
return (
<div className="flex justify-between pl-6 pr-6 pt-3 pb-4 border-b">
<div className="flex justify-between border-b px-6 pb-4 pt-3">
<div className="flex flex-col">
<span className="text-foreground-5">Status</span>
<ExecutionStatus.Badge status={status} />
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/views/execution/step-execution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const StepExecution: React.FC<StepExecutionProps> = ({ step, logs, onEdit
/>
</Layout.Horizontal>
<TabsContent value={StepExecutionTab.LOG}>
<ScrollArea className="h-[calc(100vh-23rem)] border-t pt-4 px-2">
<ScrollArea className="h-[calc(100vh-23rem)] border-t px-2 pt-4">
<ConsoleLogs logs={logs} query={query} />
</ScrollArea>
</TabsContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'

import {
Alert,
Button,
ButtonGroup,
ControlGroup,
Expand All @@ -11,8 +12,6 @@ import {
Icon,
Input,
Legend,
Message,
MessageTheme,
SkeletonForm,
Textarea
} from '@/components'
Expand All @@ -21,18 +20,14 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { z } from 'zod'

interface ProjectSettingsGeneralPageProps {
onFormSubmit: (formData: InputProps) => void
onFormSubmit: (formData: ProjectSettingsGeneralFields) => void
isUpdating: boolean
isUpdateSuccess: boolean
updateError: string | null
useSpaceStore: () => ISpaceStore
setOpenDeleteDialog: () => void
useTranslationStore: () => TranslationStore
}
interface InputProps {
identifier: string
description: string
}

const projectSettingsSchema = z.object({
identifier: z.string().min(1, { message: 'Please provide a project name' }),
Expand Down Expand Up @@ -64,7 +59,7 @@ export const ProjectSettingsGeneralPage = ({
mode: 'onSubmit',
defaultValues: {
identifier: spaceData?.identifier ?? '', //project name
description: spaceData?.description
description: spaceData?.description ?? ''
}
})

Expand All @@ -86,8 +81,8 @@ export const ProjectSettingsGeneralPage = ({
}, 1000)

reset({
identifier: spaceData?.identifier,
description: spaceData?.description
identifier: spaceData?.identifier ?? '',
description: spaceData?.description ?? ''
})

return () => clearTimeout(timer)
Expand All @@ -104,8 +99,8 @@ export const ProjectSettingsGeneralPage = ({

useEffect(() => {
reset({
identifier: spaceData?.identifier,
description: spaceData?.description
identifier: spaceData?.identifier ?? '',
description: spaceData?.description ?? ''
})
}, [spaceData, reset])

Expand Down Expand Up @@ -147,9 +142,12 @@ export const ProjectSettingsGeneralPage = ({
label={t('views:projectSettings.general.projectDescriptionLabel', 'Description')}
error={errors?.description?.message?.toString()}
/>
{updateError && <Message theme={MessageTheme.ERROR}>{updateError}</Message>}
</ControlGroup>

<Alert.Container variant="destructive">
<Alert.Title>{updateError}</Alert.Title>
</Alert.Container>

{/*BUTTON CONTROL: SAVE & CANCEL*/}
<ControlGroup type="button">
<ButtonGroup spacing="3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ const RepoWebhookExecutionsPage: FC<RepoWebhookExecutionsPageProps> = ({

return (
<SandboxLayout.Main className="mx-0">
<SandboxLayout.Content className="pl-0 max-w-[812px]">
<h1 className="text-2xl font-medium text-foreground-1 mb-4">Order Status Update Webhook</h1>
<SandboxLayout.Content className="max-w-[812px] pl-0">
<h1 className="mb-4 text-2xl font-medium text-foreground-1">Order Status Update Webhook</h1>
<Text>
This webhook triggers every time an order status is updated, sending data to the specified endpoint for
real-time tracking.
</Text>
<FormSeparator className="my-6" />
<h1 className="text-xl font-medium text-foreground-1 mb-4">Executions</h1>
<h1 className="mb-4 text-xl font-medium text-foreground-1">Executions</h1>
{isLoading ? (
<SkeletonList />
) : executions && executions.length > 0 ? (
Expand Down

0 comments on commit be10617

Please sign in to comment.