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

fix: duplicate toaster #1206

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
86 changes: 48 additions & 38 deletions apps/gitness/src/components-v2/app-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,58 +175,68 @@ export const AppShell = () => {
useRepoImportEvents()

return (
<Sidebar.Provider>
<AppSidebar
showMoreMenu={showMoreMenu}
showSettingMenu={showSettingMenu}
handleMoreMenu={handleMoreMenu}
handleSettingsMenu={handleSettingsMenu}
currentUser={currentUser}
handleCustomNav={handleCustomNav}
handleLogOut={handleLogOut}
recentMenuItems={recentMenu}
pinnedMenuItems={pinnedMenu}
handleChangePinnedMenuItem={handleChangePinnedMenuItem}
handleRemoveRecentMenuItem={handleRemoveRecentMenuItem}
useThemeStore={useThemeStore}
useTranslationStore={useTranslationStore}
/>

<Sidebar.Inset>
<BreadcrumbsAndOutlet />

<MoreSubmenu showMoreMenu={showMoreMenu} handleMoreMenu={handleMoreMenu} items={moreMenu} />
<SettingsMenu showSettingMenu={showSettingMenu} handleSettingsMenu={handleSettingsMenu} items={settingsMenu} />
<ManageNavigation
pinnedItems={pinnedMenu}
recentItems={recentMenu}
navbarMenuData={getNavbarMenuData({ t, routes, spaceId: spaceIdPathParam, repoId })}
showManageNavigation={showCustomNav}
isSubmitting={false}
submitted={false}
onSave={handleSave}
onClose={handleCustomNav}
<>
<Sidebar.Provider>
<AppSidebar
showMoreMenu={showMoreMenu}
showSettingMenu={showSettingMenu}
handleMoreMenu={handleMoreMenu}
handleSettingsMenu={handleSettingsMenu}
currentUser={currentUser}
handleCustomNav={handleCustomNav}
handleLogOut={handleLogOut}
recentMenuItems={recentMenu}
pinnedMenuItems={pinnedMenu}
handleChangePinnedMenuItem={handleChangePinnedMenuItem}
handleRemoveRecentMenuItem={handleRemoveRecentMenuItem}
useThemeStore={useThemeStore}
useTranslationStore={useTranslationStore}
/>
<Toaster />
</Sidebar.Inset>
</Sidebar.Provider>

<Sidebar.Inset>
<BreadcrumbsAndOutlet />

<MoreSubmenu showMoreMenu={showMoreMenu} handleMoreMenu={handleMoreMenu} items={moreMenu} />
<SettingsMenu
showSettingMenu={showSettingMenu}
handleSettingsMenu={handleSettingsMenu}
items={settingsMenu}
/>
<ManageNavigation
pinnedItems={pinnedMenu}
recentItems={recentMenu}
navbarMenuData={getNavbarMenuData({ t, routes, spaceId: spaceIdPathParam, repoId })}
showManageNavigation={showCustomNav}
isSubmitting={false}
submitted={false}
onSave={handleSave}
onClose={handleCustomNav}
/>
</Sidebar.Inset>
</Sidebar.Provider>
<Toaster />
</>
)
}

export const AppShellMFE = () => {
return <BreadcrumbsAndOutlet className="min-h-screen text-foreground-2" />
useRepoImportEvents()

return (
<>
<BreadcrumbsAndOutlet className="min-h-screen text-foreground-2" />
<Toaster />
</>
)
}

function BreadcrumbsAndOutlet({ className }: { className?: string }) {
useRepoImportEvents()

return (
<div className={cn('h-full flex flex-col', className)}>
<div className="layer-high sticky top-0 bg-background-1">
<Breadcrumbs />
</div>
<Outlet />
<Toaster />
</div>
)
}
21 changes: 6 additions & 15 deletions apps/gitness/src/pages-v2/repo/repo-create-page.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import { useNavigate, useParams } from 'react-router-dom'

import {
CreateRepositoryErrorResponse,
OpenapiCreateRepositoryRequest,
useCreateRepositoryMutation,
useListGitignoreQuery,
useListLicensesQuery
} from '@harnessio/code-service-client'
import { toast } from '@harnessio/ui/components'
import { FormFields, RepoCreatePage as RepoCreatePageView } from '@harnessio/ui/views'

import { Toaster } from '../../components-v2/toaster'
// import { Toaster } from '../../components-v2/toaster'
import { useRoutes } from '../../framework/context/NavigationContext'
import { useGetSpaceURLParam } from '../../framework/hooks/useGetSpaceParam'
import { useTranslationStore } from '../../i18n/stores/i18n-store'
import { PathParams } from '../../RouteDefinitions'

export const CreateRepo = () => {
const routes = useRoutes()
const createRepositoryMutation = useCreateRepositoryMutation({})
const { mutate: createRepository, error, isLoading, isSuccess } = useCreateRepositoryMutation({})
const { spaceId } = useParams<PathParams>()
const spaceURL = useGetSpaceURLParam()
const navigate = useNavigate()
Expand All @@ -35,7 +33,7 @@ export const CreateRepo = () => {
identifier: data.name
}

createRepositoryMutation.mutate(
createRepository(
{
queryParams: {
space_path: spaceURL
Expand All @@ -45,13 +43,6 @@ export const CreateRepo = () => {
{
onSuccess: ({ body: data }) => {
navigate(routes.toRepoSummary({ spaceId, repoId: data?.identifier }))
},
onError: (error: CreateRepositoryErrorResponse) => {
const message = error.message || 'An unknown error occurred.'
toast({
title: message,
variant: 'destructive'
})
}
}
)
Expand All @@ -70,13 +61,13 @@ export const CreateRepo = () => {
<RepoCreatePageView
onFormSubmit={onSubmit}
onFormCancel={onCancel}
isLoading={createRepositoryMutation.isLoading}
isSuccess={createRepositoryMutation.isSuccess}
isLoading={isLoading}
isSuccess={isSuccess}
gitIgnoreOptions={gitIgnoreOptions}
licenseOptions={licenseOptions}
useTranslationStore={useTranslationStore}
apiError={error?.message?.toString()}
/>
<Toaster />
</>
)
}
100 changes: 51 additions & 49 deletions packages/ui/locales/en/component.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,16 @@
{
"deleteDialog": {
"title": "Are you sure?",
"descriptionWithType": "This will permanently delete your {{type}} and remove all data. This action cannot be undone.",
"description": "This will permanently remove all data. This action cannot be undone.",
"inputLabel": "To confirm, type",
"cancel": "Cancel"
},
"filter": {
"delete": "Delete Filter",
"add-filter": "Add filter",
"reset": "Reset",
"defaultLabel": "Filter",
"inputPlaceholder": "Filter by...",
"buttonLabel": "Reset filters",
"is": "is",
"isNot": "is not",
"isEmpty": "is empty",
"isNotEmpty": "is not empty",
"isBefore": "is before",
"isAfter": "is after",
"isBetween": "is between",
"contains": "contains",
"doesNotContain": "does not contain",
"startsWith": "starts with",
"endsWith": "ends with",
"type": "Type",
"public": "Public",
"private": "Private",
"fork": "Fork",
"createdTime": "Created Time",
"name": "Name",
"stars": "Stars",
"ascending": "Ascending",
"descending": "Descending",
"author": "Author",
"createdBefore": "Created Before",
"createdAfter": "Created After"
},
"sort": {
"defaultLabel": "Sort",
"inputPlaceholder": "Sort by...",
"buttonLabel": "Reset sort",
"lastUpdated": "Last updated",
"stars": "Stars",
"forks": "Forks",
"pullRequests": "Pull Requests",
"title": "Title"
},
"navbar": {
"settings": "Settings",
"pin": "Pin",
"remove": "Remove",
"reorder": "Reorder",
"unpin": "Unpin",
"appearence": "Appearance",
"language": "Language",
"logout": "Log out",
"profile": "Profile",
"theme": "Theme",
"customNav": "Customize navigation",
"logout": "Log out",
"devops": "Devops",
"repositories": "Repositories",
"pipelines": "Pipelines",
Expand Down Expand Up @@ -108,6 +62,54 @@
"administration": "Administration",
"account": "Account"
},
"deleteDialog": {
"title": "Are you sure?",
"descriptionWithType": "This will permanently delete your {{type}} and remove all data. This action cannot be undone.",
"description": "This will permanently remove all data. This action cannot be undone.",
"inputLabel": "To confirm, type",
"cancel": "Cancel"
},
"filter": {
"delete": "Delete Filter",
"add-filter": "Add filter",
"reset": "Reset",
"defaultLabel": "Filter",
"inputPlaceholder": "Filter by...",
"buttonLabel": "Reset filters",
"is": "is",
"isNot": "is not",
"isEmpty": "is empty",
"isNotEmpty": "is not empty",
"isBefore": "is before",
"isAfter": "is after",
"isBetween": "is between",
"contains": "contains",
"doesNotContain": "does not contain",
"startsWith": "starts with",
"endsWith": "ends with",
"type": "Type",
"public": "Public",
"private": "Private",
"fork": "Fork",
"createdTime": "Created Time",
"name": "Name",
"stars": "Stars",
"ascending": "Ascending",
"descending": "Descending",
"author": "Author",
"createdBefore": "Created Before",
"createdAfter": "Created After"
},
"sort": {
"defaultLabel": "Sort",
"inputPlaceholder": "Sort by...",
"buttonLabel": "Reset sort",
"lastUpdated": "Last updated",
"stars": "Stars",
"forks": "Forks",
"pullRequests": "Pull Requests",
"title": "Title"
},
"pagination": {
"previous": "Previous",
"next": "Next"
Expand Down
Loading