MobileObjectsToolbar.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import MobileObjectsToolbarHeader from '@/common/components/annotations/MobileObjectsToolbarHeader';
  17. import ObjectsToolbarBottomActions from '@/common/components/annotations/ObjectsToolbarBottomActions';
  18. import {getObjectLabel} from '@/common/components/annotations/ObjectUtils';
  19. import ToolbarObject from '@/common/components/annotations/ToolbarObject';
  20. import MobileFirstClickBanner from '@/common/components/MobileFirstClickBanner';
  21. import {activeTrackletObjectAtom, isFirstClickMadeAtom} from '@/demo/atoms';
  22. import {useAtomValue} from 'jotai';
  23. type Props = {
  24. onTabChange: (newIndex: number) => void;
  25. };
  26. export default function MobileObjectsToolbar({onTabChange}: Props) {
  27. const activeTracklet = useAtomValue(activeTrackletObjectAtom);
  28. const isFirstClickMade = useAtomValue(isFirstClickMadeAtom);
  29. if (!isFirstClickMade) {
  30. return <MobileFirstClickBanner />;
  31. }
  32. return (
  33. <div className="w-full">
  34. <MobileObjectsToolbarHeader />
  35. {activeTracklet != null && (
  36. <ToolbarObject
  37. label={getObjectLabel(activeTracklet)}
  38. tracklet={activeTracklet}
  39. isActive={true}
  40. isMobile={true}
  41. />
  42. )}
  43. <ObjectsToolbarBottomActions onTabChange={onTabChange} />
  44. </div>
  45. );
  46. }