Added image picker and cleaned up main and job list screens.

This commit is contained in:
Patrick Fic
2021-02-09 23:12:52 -08:00
parent 2437808c33
commit 29bd2bc03e
29 changed files with 703 additions and 114 deletions

View File

@@ -1,7 +1,7 @@
import { useQuery } from "@apollo/client";
import { Picker } from "native-base";
import React from "react";
import { View } from "react-native";
import { Text, View } from "react-native";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
@@ -10,6 +10,7 @@ import { selectCurrentCameraJobId } from "../../redux/app/app.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import ErrorDisplay from "../error-display/error-display.component";
import LoadingDisplay from "../loading-display/loading-display.component";
import { useTranslation } from "react-i18next";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -27,17 +28,13 @@ export function CameraSelectJob({
setCameraJobId,
setCameraJob,
}) {
const { loading, error, data, refetch } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
const { loading, error, data } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
variables: {
statuses: bodyshop.md_ro_statuses.active_statuses || ["Open", "Open*"],
},
skip: !bodyshop,
});
const onRefresh = async () => {
return refetch();
};
const { t } = useTranslation();
if (loading) return <LoadingDisplay />;
if (error) return <ErrorDisplay errorMessage={error.message} />;
@@ -45,19 +42,14 @@ export function CameraSelectJob({
return (
<View
style={{
backgroundColor: "rgba(35,35,35, 0.4)",
paddingTop: 30,
//textShadow: "tomato 0px 0px 10px",
fontColor: "black",
fontSize: 20,
fontWeight: "bold",
}}
>
{!cameraJobId && <Text>{t("mediabrowser.labels.selectjob")}</Text>}
<Picker
note
selectedValue={cameraJobId}
onValueChange={(value, idx) => {
console.log(value, idx);
setCameraJobId(value);
setCameraJob(data.jobs[idx]);
}}