Skip to content

Commit

Permalink
clean up BottomButtons.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
angielt committed Dec 18, 2024
1 parent 54d4508 commit 2b41711
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 57 deletions.
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1576,4 +1576,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: eff4b75123af5d6680139a78c055b44ad37c269b

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
83 changes: 27 additions & 56 deletions src/components/ObsEdit/BottomButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@ const BottomButtons = ( {
const isSaving = buttonPressed === "save" && loading;
const disabled = buttonPressed !== null;

const saveButton = (
<Button
className="px-[25px]"
onPress={( ) => handlePress( "save" )}
testID="ObsEdit.saveButton"
text={t( "SAVE" )}
level="neutral"
loading={isSaving}
disabled={disabled}
/>
);

const saveChangesButton = (
<Button
className="px-[25px]"
Expand All @@ -66,54 +54,37 @@ const BottomButtons = ( {
/>
);

// const uploadButton = (
// <Button
// className="ml-3 grow"
// level={showFocusedUploadButton
// ? "focus"
// : "neutral"}
// text={t( "UPLOAD-NOW" )}
// testID="ObsEdit.uploadButton"
// onPress={( ) => handlePress( "upload" )}
// loading={buttonPressed === "upload" && loading}
// disabled={disabled}
// />
// );
const saveButton = {
title: t( "SAVE" ),
onPress: ( ) => handlePress( "save" ),
isPrimary: false,
testID: "ObsEdit.saveButton",
disabled,
level: "neutral",
loading: isSaving,
isPrimary: false,
className: "px-[25px]"
};

const buttons = [
{
title: t( "SAVE" ),
onPress: ( ) => handlePress( "save" ),
isPrimary: false,
testID: "ObsEdit.saveButton",
disabled,
level: "neutral",
loading: isSaving,
isPrimary: false,
className: "px-[25px]"
},
{
title: t( "UPLOAD-NOW" ),
onPress: ( ) => handlePress( "upload" ),
isPrimary: false,
testID: "ObsDetail.cvSuggestionsButton",
accessibilityHint: "Shows-identification-suggestions",
loading: buttonPressed === "upload" && loading,
level: showFocusedUploadButton
? "focus"
: "neutral",
disabled,
isPrimary: true,
className: "ml-3 grow"
}
];
const uploadButton = {
title: t( "UPLOAD-NOW" ),
onPress: ( ) => handlePress( "upload" ),
isPrimary: true,
testID: "ObsEdit.uploadButton",
loading: buttonPressed === "upload" && loading,
level: showFocusedUploadButton
? "focus"
: "neutral",
disabled,
className: "ml-3 grow"
};

const buttonConfiguration = [saveButton, uploadButton];

const renderButtons = ( ) => {
if ( canSaveOnly ) {
return (
<ButtonBar>
{saveButton}
</ButtonBar>
<ButtonBar buttonConfiguration={[saveButton]} />
);
}
if ( wasSynced ) {
Expand All @@ -124,7 +95,7 @@ const BottomButtons = ( {
);
}
return (
<ButtonBar buttonConfiguration={buttons} containerClass="p-[15px]" />
<ButtonBar buttonConfiguration={buttonConfiguration} containerClass="p-[15px]" />
);
};

Expand Down

0 comments on commit 2b41711

Please sign in to comment.