|
1 | 1 | import type { EntityType } from "@bibgraph/types"; |
2 | 2 | import { logger } from "@bibgraph/utils"; |
3 | | -import { ActionIcon, Badge, Box, Code, Group, Modal, Paper, SegmentedControl, Stack, Text, Title, Tooltip } from "@mantine/core"; |
| 3 | +import { ActionIcon, Affix, Badge, Box, Code, Group, Modal, Paper, SegmentedControl, Stack, Text, Title, Tooltip } from "@mantine/core"; |
4 | 4 | import { IconBookmark, IconBookmarkFilled, IconBookmarkOff, IconCode, IconListCheck, IconMenu2, IconX } from "@tabler/icons-react"; |
5 | 5 | import React, { ReactNode, useState } from "react"; |
6 | 6 |
|
@@ -93,6 +93,7 @@ export const EntityDetailLayout = ({ |
93 | 93 | return ( |
94 | 94 | <Box |
95 | 95 | p={isMobile() ? "sm" : "xl"} |
| 96 | + pb={isMobile() ? 80 : undefined} |
96 | 97 | bg="var(--mantine-color-body)" |
97 | 98 | style={{ minHeight: '100%' }} |
98 | 99 | data-testid="entity-detail-layout" |
@@ -387,6 +388,86 @@ export const EntityDetailLayout = ({ |
387 | 388 | }} |
388 | 389 | /> |
389 | 390 | </Modal> |
| 391 | + |
| 392 | + {/* Mobile Sticky Bottom Action Bar */} |
| 393 | + {isMobile() && ( |
| 394 | + <Affix position={{ bottom: 0, left: 0, right: 0 }}> |
| 395 | + <Paper |
| 396 | + p="sm" |
| 397 | + shadow="lg" |
| 398 | + style={{ |
| 399 | + borderTop: '1px solid var(--mantine-color-gray-3)', |
| 400 | + borderRadius: 0, |
| 401 | + backgroundColor: 'var(--mantine-color-body)', |
| 402 | + }} |
| 403 | + > |
| 404 | + <Group justify="space-around" gap="xs"> |
| 405 | + <Tooltip label="Add to list" position="top"> |
| 406 | + <ActionIcon |
| 407 | + size="lg" |
| 408 | + variant="light" |
| 409 | + color="green" |
| 410 | + onClick={() => setShowAddToListModal(true)} |
| 411 | + aria-label="Add to catalogue list" |
| 412 | + > |
| 413 | + <IconListCheck size={ICON_SIZE.LG} /> |
| 414 | + </ActionIcon> |
| 415 | + </Tooltip> |
| 416 | + |
| 417 | + <Tooltip |
| 418 | + label={userInteractions.isBookmarked ? "Remove bookmark" : "Bookmark"} |
| 419 | + position="top" |
| 420 | + > |
| 421 | + <ActionIcon |
| 422 | + size="lg" |
| 423 | + variant={userInteractions.isBookmarked ? "filled" : "light"} |
| 424 | + color={userInteractions.isBookmarked ? "yellow" : "gray"} |
| 425 | + onClick={handleBookmarkToggle} |
| 426 | + loading={userInteractions.isLoadingBookmarks} |
| 427 | + aria-label={userInteractions.isBookmarked ? "Remove bookmark" : "Add bookmark"} |
| 428 | + > |
| 429 | + {userInteractions.isBookmarked ? ( |
| 430 | + <IconBookmark size={ICON_SIZE.LG} fill="currentColor" /> |
| 431 | + ) : ( |
| 432 | + <IconBookmarkOff size={ICON_SIZE.LG} /> |
| 433 | + )} |
| 434 | + </ActionIcon> |
| 435 | + </Tooltip> |
| 436 | + |
| 437 | + {(selectParam || Object.keys(queryBookmarking.currentQueryParams).length > 0) && ( |
| 438 | + <Tooltip |
| 439 | + label={queryBookmarking.isQueryBookmarked ? "Remove query bookmark" : "Bookmark query"} |
| 440 | + position="top" |
| 441 | + > |
| 442 | + <ActionIcon |
| 443 | + size="lg" |
| 444 | + variant={queryBookmarking.isQueryBookmarked ? "filled" : "light"} |
| 445 | + color={queryBookmarking.isQueryBookmarked ? "blue" : "gray"} |
| 446 | + onClick={handleQueryBookmarkToggle} |
| 447 | + aria-label={queryBookmarking.isQueryBookmarked ? "Remove query bookmark" : "Add query bookmark"} |
| 448 | + > |
| 449 | + {queryBookmarking.isQueryBookmarked ? ( |
| 450 | + <IconBookmarkFilled size={ICON_SIZE.LG} /> |
| 451 | + ) : ( |
| 452 | + <IconBookmark size={ICON_SIZE.LG} /> |
| 453 | + )} |
| 454 | + </ActionIcon> |
| 455 | + </Tooltip> |
| 456 | + )} |
| 457 | + |
| 458 | + <SegmentedControl |
| 459 | + size="xs" |
| 460 | + value={viewMode} |
| 461 | + onChange={(value) => onViewModeChange(value as DetailViewMode)} |
| 462 | + data={[ |
| 463 | + { label: 'Rich', value: 'rich' }, |
| 464 | + { label: 'Raw', value: 'raw' }, |
| 465 | + ]} |
| 466 | + /> |
| 467 | + </Group> |
| 468 | + </Paper> |
| 469 | + </Affix> |
| 470 | + )} |
390 | 471 | </Box> |
391 | 472 | ); |
392 | 473 | }; |
0 commit comments