mirror of
https://github.com/BZmHackTeam/BezpiecznaZywnosc
synced 2024-12-22 22:46:59 +01:00
MVP pre-(?)release
This commit is contained in:
parent
76188d31f2
commit
436fe37dd2
9 changed files with 121 additions and 99 deletions
|
@ -21,6 +21,7 @@ import '@ionic/react/css/display.css';
|
||||||
|
|
||||||
/* Theme variables */
|
/* Theme variables */
|
||||||
import './theme/variables.css';
|
import './theme/variables.css';
|
||||||
|
|
||||||
import Submit from './pages/Report';
|
import Submit from './pages/Report';
|
||||||
|
|
||||||
setupIonicReact();
|
setupIonicReact();
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-right: 12px;
|
|
||||||
}
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
import SearchFilter from "./SearchFilter/SearchFilter";
|
|
||||||
import Searchbar from "./Searchbar/Searchbar";
|
import Searchbar from "./Searchbar/Searchbar";
|
||||||
|
|
||||||
import styles from "./Search.module.css";
|
import styles from "./Search.module.css";
|
||||||
|
@ -7,7 +6,6 @@ const Search: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<div className={`${styles.search}`}>
|
<div className={`${styles.search}`}>
|
||||||
<Searchbar />
|
<Searchbar />
|
||||||
<SearchFilter />
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
.searchfilter {
|
|
||||||
width: 64px;
|
|
||||||
height: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ion-button.searchfilter {
|
|
||||||
--padding-start: 0px !important;
|
|
||||||
--padding-end: 0px !important;
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
import { IonButton, IonIcon } from "@ionic/react";
|
|
||||||
|
|
||||||
import { ellipsisVerticalOutline } from "ionicons/icons";
|
|
||||||
|
|
||||||
import styles from "./SearchFilter.module.css";
|
|
||||||
|
|
||||||
const SearchFilter: React.FC = () => {
|
|
||||||
return (
|
|
||||||
<IonButton className={styles.searchfilter} size="small" shape="round">
|
|
||||||
<IonIcon icon={ellipsisVerticalOutline} />
|
|
||||||
</IonButton>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default SearchFilter;
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
.label {
|
||||||
|
width: 100%;
|
||||||
|
--width: 100%;
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
import { IonBackButton, IonButton, IonButtons, IonContent, IonHeader, IonInfiniteScroll, IonInfiniteScrollContent, IonItem, IonLabel, IonList, IonModal, IonTitle, IonToolbar, useIonRouter } from "@ionic/react";
|
import { IonBackButton, IonButton, IonButtons, IonContent, IonHeader, IonIcon, IonInfiniteScroll, IonInfiniteScrollContent, IonItem, IonLabel, IonList, IonModal, IonRouterContext, IonSearchbar, IonTitle, IonToolbar, useIonRouter } from "@ionic/react";
|
||||||
|
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useContext, useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
import styles from "./WarningsList.module.css";
|
import styles from "./WarningsList.module.css";
|
||||||
|
import { Redirect, Route, Router, __RouterContext, useLocation } from "react-router";
|
||||||
|
import { chevronBack, closeOutline } from "ionicons/icons";
|
||||||
|
|
||||||
const WarningsList: React.FC = () => {
|
const WarningsList: React.FC = () => {
|
||||||
const [dataset, setDataset] = useState<any[]>([]);
|
const [dataset, setDataset] = useState<any[]>([]);
|
||||||
|
@ -12,7 +14,9 @@ const WarningsList: React.FC = () => {
|
||||||
const [pageIndex, setPageIndex] = useState(1);
|
const [pageIndex, setPageIndex] = useState(1);
|
||||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
const [currentlySelectedWarning, setCurrentlySelectedWarning] = useState<object>();
|
const [currentlySelectedWarning, setCurrentlySelectedWarning] = useState<object>();
|
||||||
|
const { push } = useIonRouter();
|
||||||
const eventRef = useRef();
|
const eventRef = useRef();
|
||||||
|
const [searchValue, setSearchValue] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getDataset() {
|
async function getDataset() {
|
||||||
|
@ -89,13 +93,24 @@ const WarningsList: React.FC = () => {
|
||||||
setIsModalOpen(true);
|
setIsModalOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
return warningsContent.length > 0 ? (
|
function closeModal() {
|
||||||
|
setCurrentlySelectedWarning(undefined);
|
||||||
|
setIsModalOpen(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleInputValueChange(event: any) {
|
||||||
|
setSearchValue(event.detail.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
<>
|
<>
|
||||||
|
<IonSearchbar placeholder="Wpisz słowo kluczowe" value={searchValue} onIonChange={handleInputValueChange} />
|
||||||
|
{warningsContent.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<IonList lines="full">
|
<IonList lines="full">
|
||||||
{warningsContent.map((warningContent, key) => (
|
{warningsContent.map((warningContent, key) => (
|
||||||
<IonItem detail onClick={() => openModal(warningContent)} button key={key}>
|
<IonItem detail onClick={() => openModal(warningContent)} button key={key}>
|
||||||
<IonLabel>
|
<IonLabel className="ion-text-wrap">
|
||||||
{warningContent.col7.val}
|
{warningContent.col7.val}
|
||||||
</IonLabel>
|
</IonLabel>
|
||||||
</IonItem>
|
</IonItem>
|
||||||
|
@ -107,46 +122,75 @@ const WarningsList: React.FC = () => {
|
||||||
<IonTitle>
|
<IonTitle>
|
||||||
Szczegóły
|
Szczegóły
|
||||||
</IonTitle>
|
</IonTitle>
|
||||||
|
<IonButtons slot="start">
|
||||||
|
<IonButton onClick={closeModal}>
|
||||||
|
<IonIcon icon={chevronBack} />
|
||||||
|
Powrót
|
||||||
|
</IonButton>
|
||||||
|
</IonButtons>
|
||||||
</IonToolbar>
|
</IonToolbar>
|
||||||
</IonHeader>
|
</IonHeader>
|
||||||
<IonContent>
|
<IonContent>
|
||||||
<IonHeader collapse="condense">
|
|
||||||
<IonToolbar>
|
|
||||||
<IonTitle size="large">
|
|
||||||
Szczegóły
|
|
||||||
</IonTitle>
|
|
||||||
</IonToolbar>
|
|
||||||
</IonHeader>
|
|
||||||
{currentlySelectedWarning !== undefined && currentlySelectedWarning !== null && (
|
{currentlySelectedWarning !== undefined && currentlySelectedWarning !== null && (
|
||||||
<IonList lines="full">
|
<IonList lines="full">
|
||||||
<IonItem>
|
<IonItem>
|
||||||
<IonLabel>
|
<IonLabel className={`${styles.label} ion-text-wrap`}>
|
||||||
|
<h1>
|
||||||
{(currentlySelectedWarning as any).col3.val}
|
{(currentlySelectedWarning as any).col3.val}
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
województwo
|
||||||
|
</p>
|
||||||
</IonLabel>
|
</IonLabel>
|
||||||
</IonItem>
|
</IonItem>
|
||||||
<IonItem>
|
<IonItem>
|
||||||
<IonLabel>
|
<IonLabel className={`${styles.label} ion-text-wrap`}>
|
||||||
|
<h1>
|
||||||
{(currentlySelectedWarning as any).col2.val}
|
{(currentlySelectedWarning as any).col2.val}
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
nazwa kodowa
|
||||||
|
</p>
|
||||||
</IonLabel>
|
</IonLabel>
|
||||||
</IonItem>
|
</IonItem>
|
||||||
<IonItem>
|
<IonItem>
|
||||||
<IonLabel>
|
<IonLabel className={`${styles.label} ion-text-wrap`}>
|
||||||
|
<h1>
|
||||||
{(currentlySelectedWarning as any).col5.val}
|
{(currentlySelectedWarning as any).col5.val}
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
firma
|
||||||
|
</p>
|
||||||
</IonLabel>
|
</IonLabel>
|
||||||
</IonItem>
|
</IonItem>
|
||||||
<IonItem>
|
<IonItem>
|
||||||
<IonLabel>
|
<IonLabel className={`${styles.label} ion-text-wrap`}>
|
||||||
|
<h1>
|
||||||
{(currentlySelectedWarning as any).col6.val}
|
{(currentlySelectedWarning as any).col6.val}
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
kategoria
|
||||||
|
</p>
|
||||||
</IonLabel>
|
</IonLabel>
|
||||||
</IonItem>
|
</IonItem>
|
||||||
<IonItem>
|
<IonItem>
|
||||||
<IonLabel>
|
<IonLabel className={`${styles.label} ion-text-wrap`}>
|
||||||
|
<h1>
|
||||||
{(currentlySelectedWarning as any).col7.val}
|
{(currentlySelectedWarning as any).col7.val}
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
nazwa produktu
|
||||||
|
</p>
|
||||||
</IonLabel>
|
</IonLabel>
|
||||||
</IonItem>
|
</IonItem>
|
||||||
<IonItem>
|
<IonItem className={`${styles.label} ion-text-wrap`}>
|
||||||
<IonLabel>
|
<IonLabel>
|
||||||
|
<h1 className="ion-text-wrap">
|
||||||
{(currentlySelectedWarning as any).col9.val}
|
{(currentlySelectedWarning as any).col9.val}
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
powód zgłoszenia
|
||||||
|
</p>
|
||||||
</IonLabel>
|
</IonLabel>
|
||||||
</IonItem>
|
</IonItem>
|
||||||
</IonList>
|
</IonList>
|
||||||
|
@ -157,8 +201,9 @@ const WarningsList: React.FC = () => {
|
||||||
<IonInfiniteScrollContent />
|
<IonInfiniteScrollContent />
|
||||||
</IonInfiniteScroll>
|
</IonInfiniteScroll>
|
||||||
</>
|
</>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
) : <></>;
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default WarningsList;
|
export default WarningsList;
|
|
@ -23,7 +23,6 @@ const Home: React.FC = () => {
|
||||||
<div className={`${styles.addWarningButtonDiv} ion-padding-horizontal`}>
|
<div className={`${styles.addWarningButtonDiv} ion-padding-horizontal`}>
|
||||||
<AddWarningButton />
|
<AddWarningButton />
|
||||||
</div>
|
</div>
|
||||||
<Search />
|
|
||||||
<WarningsList />
|
<WarningsList />
|
||||||
</IonContent>
|
</IonContent>
|
||||||
</IonPage>
|
</IonPage>
|
||||||
|
|
|
@ -121,8 +121,8 @@ const handleInputChange = (fieldName: any, value: any) => {
|
||||||
/>
|
/>
|
||||||
</IonItem>
|
</IonItem>
|
||||||
|
|
||||||
<div style={{width: "100%", display: "flex", justifyContent: "center"}} className="ion-margin-top">
|
<div style={{width: "100%", display: "flex", justifyContent: "center"}} className="ion-padding-horizontal">
|
||||||
<IonButton style={{"--width": "100%"}} size="large" onClick={(e) => handleSubmit(e as any)} type="submit">
|
<IonButton style={{"--width": "100%", "width": "100%", "margin-top": "320px"}} size="large" onClick={(e) => handleSubmit(e as any)} type="submit">
|
||||||
Wyślij
|
Wyślij
|
||||||
</IonButton>
|
</IonButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue