Skip to content

Commit

Permalink
refactor: clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
gca-axelor committed Dec 17, 2024
1 parent ac38201 commit b2bcf42
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
*/

import React from 'react';
import {View, StyleSheet, Text} from 'react-native';
import {HorizontalRule, useThemeColor} from '@axelor/aos-mobile-ui';
import {View, StyleSheet} from 'react-native';
import {HorizontalRule, useThemeColor, Text} from '@axelor/aos-mobile-ui';

interface HorizontalRuleTextProps {
text?: string;
text: string;
style?: any;
textStyle?: any;
}
Expand All @@ -37,11 +37,9 @@ const HorizontalRuleText = ({
<View style={[styles.container, style]}>
<HorizontalRule style={styles.line} />
<Text
style={[
styles.text,
{color: Colors.secondaryColor.foreground},
textStyle,
]}>
fontSize={14}
textColor={Colors.secondaryColor.foreground}
style={textStyle}>
{text}
</Text>
<HorizontalRule style={styles.line} />
Expand All @@ -60,10 +58,6 @@ const styles = StyleSheet.create({
flex: 1,
marginHorizontal: 10,
},
text: {
fontSize: 14,
textAlign: 'center',
},
});

export default HorizontalRuleText;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import React from 'react';
import {StyleSheet, View} from 'react-native';
import {useNavigation, useTranslator} from '@axelor/aos-mobile-core';
import {useTranslator} from '@axelor/aos-mobile-core';
import {Button, useThemeColor} from '@axelor/aos-mobile-ui';
import {RequestCreation} from '../../../types';

Expand All @@ -43,7 +43,6 @@ const RequestCreationButton = ({
}: RequestCreationButtonProps) => {
const Colors = useThemeColor();
const I18n = useTranslator();
const navigation = useNavigation();

const handleFinishPress = () => {
if (step === RequestCreation.step.validateLine) {
Expand All @@ -52,9 +51,7 @@ const RequestCreationButton = ({
setStep(RequestCreation.step.finish);
};

const handleRealizePress = () => {
navigation.popToTop();
};
const handleRealizePress = () => {};

if (
(step === RequestCreation.step.addLine && lines.length >= 1) ||
Expand All @@ -65,7 +62,7 @@ const RequestCreationButton = ({
{step === RequestCreation.step.validateLine && (
<Button
title={I18n.t(isEditionMode ? 'Base_Save' : 'Base_Add')}
iconName={isEditionMode ? null : 'plus-lg'}
iconName={isEditionMode ? 'floppy-fill' : 'plus-lg'}
color={Colors.progressColor}
width="45%"
disabled={movedQty === 0}
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/purchase/src/components/templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
export {default as CompanyPicker} from './CompanyPicker/CompanyPicker';
export {default as ProductSearchBar} from './ProductSearchBar/ProductSearchBar';
export {default as RequestCreationButton} from './RequestCreationButton/RequestCreationButton';
export {default as RequestCreationQuantityCard} from './RequestCreationQuantityCard/RequestCreationQuantityCard';
export {default as SupplierSearchBar} from './SupplierSearchBar/SupplierSearchBar';
export {default as UnitSearchBar} from './UnitSearchBar/UnitSearchBar';
export {default as RequestCreationQuantityCard} from './RequestCreationQuantityCard/RequestCreationQuantityCard';
9 changes: 8 additions & 1 deletion packages/apps/purchase/src/screens/RequestCreationScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ const RequestCreationScreen = () => {
isScrollViewContainer
/>
)}
<HorizontalRuleText text={I18n.t('Purchase_Or')} style={styles.rule} />
{currentStep < RequestCreation.step.validateLine && (
<HorizontalRuleText
text={I18n.t('Purchase_Or')}
style={styles.rule}
/>
)}
{(currentStep === RequestCreation.step.addLine ||
(RequestCreation.step.validateLine && isCustomProduct)) && (
<FormInput
Expand Down Expand Up @@ -195,9 +200,11 @@ const RequestCreationScreen = () => {
const styles = StyleSheet.create({
container: {
alignItems: 'center',
paddingTop: 10,
},
rule: {
marginVertical: 15,
width: '80%',
},
});

Expand Down

0 comments on commit b2bcf42

Please sign in to comment.