-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/production' into add_delete_tree…
…_rank_api
- Loading branch information
Showing
21 changed files
with
292 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
specifyweb/frontend/js_src/lib/components/Statistics/DeleteCategory.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react'; | ||
|
||
import { useBooleanState } from '../../hooks/useBooleanState'; | ||
import { commonText } from '../../localization/common'; | ||
import { statsText } from '../../localization/stats'; | ||
import { StringToJsx } from '../../localization/utils'; | ||
import { localized } from '../../utils/types'; | ||
import { Button } from '../Atoms/Button'; | ||
import { className } from '../Atoms/className'; | ||
import { Dialog } from '../Molecules/Dialog'; | ||
|
||
export function DeleteStatsCategory({ | ||
onDelete: handleDelete, | ||
categoryLabel, | ||
}: { | ||
readonly categoryLabel: string; | ||
readonly onDelete: () => void; | ||
}): JSX.Element { | ||
const [triedToDelete, _, __, toggleTriedToDelete] = useBooleanState(false); | ||
return ( | ||
<> | ||
<Button.Small | ||
variant={className.secondaryButton} | ||
onClick={toggleTriedToDelete} | ||
> | ||
{statsText.deleteCategory()} | ||
</Button.Small> | ||
{triedToDelete && ( | ||
<Dialog | ||
buttons={ | ||
<> | ||
<Button.Danger | ||
onClick={() => { | ||
handleDelete(); | ||
toggleTriedToDelete(); | ||
}} | ||
> | ||
{commonText.delete()} | ||
</Button.Danger> | ||
<span className="-ml-2 flex-1" /> | ||
<Button.DialogClose>{commonText.cancel()}</Button.DialogClose> | ||
</> | ||
} | ||
header={localized( | ||
`${statsText.deleteCategory()} '${categoryLabel}'?` | ||
)} | ||
onClose={toggleTriedToDelete} | ||
> | ||
{statsText.deleteWarning()}{' '} | ||
<StringToJsx | ||
components={{ | ||
wrap: <i className="flex items-center gap-2">{categoryLabel}</i>, | ||
}} | ||
string={commonText.jsxColonLine({ | ||
label: statsText.categoryToDelete(), | ||
})} | ||
/> | ||
</Dialog> | ||
)} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.