Demo adjustments, resolve upload issues, remove messaging.

This commit is contained in:
Patrick Fic
2021-01-12 18:28:58 -08:00
parent 06dda3639f
commit 7d1a265dee
18 changed files with 656 additions and 78 deletions

View File

@@ -8,6 +8,7 @@ import {
Text,
TouchableOpacity,
View,
RefreshControl,
} from "react-native";
import MediaCacheOverlay from "../media-cache-overlay/media-cache-overlay.component";
@@ -19,10 +20,17 @@ export default function JobDocumentsComponent({ job, loading, refetch }) {
const { t } = useTranslation();
const [previewVisible, setPreviewVisible] = useState(false);
const [imgIndex, setImgIndex] = useState(0);
const onRefresh = async () => {
return refetch();
};
return (
<Container>
<Content padder>
<Content
padder
refreshControl={
<RefreshControl refreshing={loading} onRefresh={onRefresh} />
}
>
<FlatList
data={job.documents}
style={{ flex: 1 }}

View File

@@ -21,6 +21,7 @@ const mapDispatchToProps = (dispatch) => ({
});
export function JobListItem({ setCameraJob, setCameraJobId, item }) {
const { t } = useTranslation();
const navigation = useNavigation();
const RenderRightAction = (props) => {
const navigation = useNavigation();
@@ -44,7 +45,7 @@ export function JobListItem({ setCameraJob, setCameraJobId, item }) {
const onPress = () => {
navigation.push("JobDetail", {
jobId: item.id,
title: item.ro_number ? item.ro_number : `EST-${item.est_number}`,
title: item.ro_number || t("general.labels.na"),
});
};
@@ -55,7 +56,7 @@ export function JobListItem({ setCameraJob, setCameraJobId, item }) {
<CardItem header bordered first button>
<View style={localStyles.item_header}>
<H3 style={localStyles.item_header_content}>
{item.ro_number ? item.ro_number : `EST-${item.est_number}`}
{item.ro_number || t("general.labels.na")}
</H3>
<Text style={localStyles.item_header_margin}>
{item.clm_no || ""}

View File

@@ -157,11 +157,13 @@ const BottomTabsNavigator = () => (
options={{ title: i18n.t("mediacache.titles.mediacachetab") }}
component={MediaCacheStackNavigator}
/>
<BottomTabs.Screen
name="MessagingTab"
options={{ title: i18n.t("messaging.titles.messagingtab") }}
component={MessagingStackNavigator}
/>
{
// <BottomTabs.Screen
// name="MessagingTab"
// options={{ title: i18n.t("messaging.titles.messagingtab") }}
// component={MessagingStackNavigator}
// />
}
</BottomTabs.Navigator>
);

View File

@@ -3,6 +3,7 @@ import {
Button,
Container,
Content,
Spinner,
Text as NBText,
Thumbnail,
View,
@@ -15,18 +16,27 @@ import {
removeAllPhotos,
uploadAllPhotos,
} from "../../redux/photos/photos.actions";
import { selectPhotos } from "../../redux/photos/photos.selectors";
import {
selectPhotos,
selectUploadInProgress,
} from "../../redux/photos/photos.selectors";
import MediaCacheOverlay from "../media-cache-overlay/media-cache-overlay.component";
const mapStateToProps = createStructuredSelector({
photos: selectPhotos,
uploadInProgress: selectUploadInProgress,
});
const mapDispatchToProps = (dispatch) => ({
removeAllPhotos: () => dispatch(removeAllPhotos()),
uploadAllphotos: () => dispatch(uploadAllPhotos()),
});
export function ScreenMediaCache({ photos, removeAllPhotos, uploadAllphotos }) {
export function ScreenMediaCache({
photos,
removeAllPhotos,
uploadAllphotos,
uploadInProgress,
}) {
const [previewVisible, setPreviewVisible] = useState(false);
const [imgIndex, setImgIndex] = useState(0);
const [imagesInDir, setImagesInDir] = useState([]);
@@ -42,7 +52,7 @@ export function ScreenMediaCache({ photos, removeAllPhotos, uploadAllphotos }) {
photos.length;
check();
}, [photos]);
console.log("upinprog", uploadInProgress);
return (
<Container>
<Content>
@@ -51,7 +61,8 @@ export function ScreenMediaCache({ photos, removeAllPhotos, uploadAllphotos }) {
<NBText>Delete all</NBText>
</Button>
<Button onPress={() => uploadAllphotos()}>
<NBText>Upload all</NBText>
<NBText>Upload all </NBText>
{uploadInProgress && <Spinner />}
</Button>
</View>
<Text>{`${photos.length} Photos`}</Text>
@@ -76,7 +87,6 @@ export function ScreenMediaCache({ photos, removeAllPhotos, uploadAllphotos }) {
)
}
/>
<MediaCacheOverlay
imgIndex={imgIndex}
setImgIndex={setImgIndex}