updating feature flag value
This commit is contained in:
@@ -4,6 +4,7 @@ import Pilots from './components/pilots/Pilots';
|
|||||||
import { useAppContext } from './hooks/appContext/UseAppContext';
|
import { useAppContext } from './hooks/appContext/UseAppContext';
|
||||||
import axios, { AxiosResponse } from 'axios';
|
import axios, { AxiosResponse } from 'axios';
|
||||||
import { useFeatureFlag } from './hooks/featureFlag/UseFeatureFlag';
|
import { useFeatureFlag } from './hooks/featureFlag/UseFeatureFlag';
|
||||||
|
import { IFeatureFlagValue } from './hooks/featureFlag/IFeatureFlagValue';
|
||||||
|
|
||||||
const App: React.FC<unknown> = () => {
|
const App: React.FC<unknown> = () => {
|
||||||
const appContext = useAppContext();
|
const appContext = useAppContext();
|
||||||
@@ -14,7 +15,7 @@ const App: React.FC<unknown> = () => {
|
|||||||
const response: AxiosResponse = await axios.get(
|
const response: AxiosResponse = await axios.get(
|
||||||
`http://localhost:7071/api/featureFlags?key=flying*&label=${process.env.NODE_ENV}`
|
`http://localhost:7071/api/featureFlags?key=flying*&label=${process.env.NODE_ENV}`
|
||||||
);
|
);
|
||||||
const featureFlags: unknown[] = response.data;
|
const featureFlags: IFeatureFlagValue[] = response.data;
|
||||||
|
|
||||||
if (featureFlags.length > 0) {
|
if (featureFlags.length > 0) {
|
||||||
appContext.dispatch({
|
appContext.dispatch({
|
||||||
|
|||||||
@@ -1,122 +1,122 @@
|
|||||||
import React from 'react';
|
// import React from 'react';
|
||||||
import {
|
// import {
|
||||||
Accordion,
|
// Accordion,
|
||||||
AccordionItem,
|
// AccordionItem,
|
||||||
Button,
|
// Button,
|
||||||
DatePicker,
|
// DatePicker,
|
||||||
Input
|
// Input
|
||||||
} from '@nextui-org/react';
|
// } from '@nextui-org/react';
|
||||||
import { useForm, Controller, SubmitHandler } from 'react-hook-form';
|
// import { useForm, Controller, SubmitHandler } from 'react-hook-form';
|
||||||
|
|
||||||
const LogbookEntryForm: React.FC<unknown> = () => {
|
// const LogbookEntryForm: React.FC<unknown> = () => {
|
||||||
const { control, handleSubmit } = useForm();
|
// const { control, handleSubmit } = useForm();
|
||||||
|
|
||||||
const onSubmit = (data: unknown) => {
|
// const onSubmit = (data: unknown) => {
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
};
|
// };
|
||||||
|
|
||||||
return (
|
// return (
|
||||||
<form className="m-10" onSubmit={handleSubmit(onSubmit)}>
|
// <form className="m-10" onSubmit={handleSubmit(onSubmit)}>
|
||||||
<div className="grid grid-cols-2 gap-4">
|
// <div className="grid grid-cols-2 gap-4">
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Date</label>
|
// <label>Date</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="date"
|
// name="date"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => <DatePicker labelPlacement="outside-left" />}
|
// render={({ field }) => <DatePicker labelPlacement="outside-left" />}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Aircraft Type</label>
|
// <label>Aircraft Type</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="aircraftType"
|
// name="aircraftType"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => (
|
// render={({ field }) => (
|
||||||
<Input fullWidth={true} labelPlacement="outside-left" />
|
// <Input fullWidth={true} labelPlacement="outside-left" />
|
||||||
)}
|
// )}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Aircraft Identity</label>
|
// <label>Aircraft Identity</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="aircraftIdent"
|
// name="aircraftIdent"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => (
|
// render={({ field }) => (
|
||||||
<Input fullWidth={true} labelPlacement="outside-left" />
|
// <Input fullWidth={true} labelPlacement="outside-left" />
|
||||||
)}
|
// )}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Route To</label>
|
// <label>Route To</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="routeTo"
|
// name="routeTo"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => <Input />}
|
// render={({ field }) => <Input />}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Route From</label>
|
// <label>Route From</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="routeFrom"
|
// name="routeFrom"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => <Input />}
|
// render={({ field }) => <Input />}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Duration of Flight</label>
|
// <label>Duration of Flight</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="flightDuration"
|
// name="flightDuration"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => <Input />}
|
// render={({ field }) => <Input />}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Single Engine Land</label>
|
// <label>Single Engine Land</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="aircraftSEL"
|
// name="aircraftSEL"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => <Input />}
|
// render={({ field }) => <Input />}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
<div className="col-span-2">
|
// <div className="col-span-2">
|
||||||
<Accordion>
|
// <Accordion>
|
||||||
<AccordionItem title="Aircraft Category and Class">
|
// <AccordionItem title="Aircraft Category and Class">
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Single Engine Land</label>
|
// <label>Single Engine Land</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="aircraftSEL"
|
// name="aircraftSEL"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => <Input />}
|
// render={({ field }) => <Input />}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
</AccordionItem>
|
// </AccordionItem>
|
||||||
</Accordion>
|
// </Accordion>
|
||||||
</div>
|
// </div>
|
||||||
<div className="col-span-2 justify-self-end">
|
// <div className="col-span-2 justify-self-end">
|
||||||
<Button color="default">Cancel</Button>
|
// <Button color="default">Cancel</Button>
|
||||||
<Button className="ml-10" color="primary">
|
// <Button className="ml-10" color="primary">
|
||||||
Save
|
// Save
|
||||||
</Button>
|
// </Button>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</form>
|
// </form>
|
||||||
);
|
// );
|
||||||
};
|
// };
|
||||||
|
|
||||||
export default LogbookEntryForm;
|
// export default LogbookEntryForm;
|
||||||
|
|||||||
@@ -1,85 +1,85 @@
|
|||||||
import {
|
// import {
|
||||||
Accordion,
|
// Accordion,
|
||||||
AccordionItem,
|
// AccordionItem,
|
||||||
Button,
|
// Button,
|
||||||
DatePicker,
|
// DatePicker,
|
||||||
Input,
|
// Input,
|
||||||
Select,
|
// Select,
|
||||||
SelectItem
|
// SelectItem
|
||||||
} from '@nextui-org/react';
|
// } from '@nextui-org/react';
|
||||||
import { useForm, Controller, SubmitHandler } from 'react-hook-form';
|
// import { useForm, Controller, SubmitHandler } from 'react-hook-form';
|
||||||
|
|
||||||
const PilotForm: React.FC<unknown> = () => {
|
// const PilotForm: React.FC<unknown> = () => {
|
||||||
const { control, handleSubmit } = useForm();
|
// const { control, handleSubmit } = useForm();
|
||||||
|
|
||||||
const onSubmit = (data: unknown) => {
|
// const onSubmit = (data: unknown) => {
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
};
|
// };
|
||||||
|
|
||||||
return (
|
// return (
|
||||||
<form className="m-10" onSubmit={handleSubmit(onSubmit)}>
|
// <form className="m-10" onSubmit={handleSubmit(onSubmit)}>
|
||||||
<div className="grid grid-cols-2 gap-4">
|
// <div className="grid grid-cols-2 gap-4">
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>First Name</label>
|
// <label>First Name</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="firstName"
|
// name="firstName"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => <Input />}
|
// render={({ field }) => <Input />}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Last Name</label>
|
// <label>Last Name</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="lastName"
|
// name="lastName"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => <Input />}
|
// render={({ field }) => <Input />}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<Accordion>
|
// <Accordion>
|
||||||
<AccordionItem title="Medical Certificate">
|
// <AccordionItem title="Medical Certificate">
|
||||||
<div className="grid grid-cols-2 gap-4">
|
// <div className="grid grid-cols-2 gap-4">
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Class</label>
|
// <label>Class</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="medicalClass"
|
// name="medicalClass"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => (
|
// render={({ field }) => (
|
||||||
<Select>
|
// <Select>
|
||||||
<SelectItem key="first" value="First">
|
// <SelectItem key="first" value="First">
|
||||||
First
|
// First
|
||||||
</SelectItem>
|
// </SelectItem>
|
||||||
<SelectItem key="second" value="Second">
|
// <SelectItem key="second" value="Second">
|
||||||
Second
|
// Second
|
||||||
</SelectItem>
|
// </SelectItem>
|
||||||
<SelectItem key="Third" value="Third">
|
// <SelectItem key="Third" value="Third">
|
||||||
Third
|
// Third
|
||||||
</SelectItem>
|
// </SelectItem>
|
||||||
</Select>
|
// </Select>
|
||||||
)}
|
// )}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
<div className="self-center">
|
// <div className="self-center">
|
||||||
<label>Expires</label>
|
// <label>Expires</label>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<Controller
|
// <Controller
|
||||||
name="medicalExpiration"
|
// name="medicalExpiration"
|
||||||
control={control}
|
// control={control}
|
||||||
render={({ field }) => <DatePicker />}
|
// render={({ field }) => <DatePicker />}
|
||||||
/>
|
// />
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</AccordionItem>
|
// </AccordionItem>
|
||||||
</Accordion>
|
// </Accordion>
|
||||||
</form>
|
// </form>
|
||||||
);
|
// );
|
||||||
};
|
// };
|
||||||
|
|
||||||
export default PilotForm;
|
// export default PilotForm;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import SiteNav from '../siteNav/SiteNav';
|
import SiteNav from '../siteNav/SiteNav';
|
||||||
import PilotForm from '../pilotForm/PilotForm';
|
// import PilotForm from '../pilotForm/PilotForm';
|
||||||
import { Button } from '@nextui-org/react';
|
import { Button } from '@nextui-org/react';
|
||||||
import {
|
import {
|
||||||
Drawer,
|
Drawer,
|
||||||
@@ -37,9 +37,7 @@ const Pilots: React.FC<unknown> = () => {
|
|||||||
<DrawerHeader>
|
<DrawerHeader>
|
||||||
<h2>Add Pilot</h2>
|
<h2>Add Pilot</h2>
|
||||||
</DrawerHeader>
|
</DrawerHeader>
|
||||||
<DrawerBody>
|
<DrawerBody>{/* <PilotForm /> */}</DrawerBody>
|
||||||
<PilotForm />
|
|
||||||
</DrawerBody>
|
|
||||||
<DrawerFooter>
|
<DrawerFooter>
|
||||||
<div className="flex gap-4 justify-end justify-self-center">
|
<div className="flex gap-4 justify-end justify-self-center">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { IFeatureFlagValue } from '../../hooks/featureFlag/IFeatureFlagValue';
|
||||||
|
|
||||||
export interface IAppContextState {
|
export interface IAppContextState {
|
||||||
featureFlags: unknown[];
|
featureFlags: IFeatureFlagValue[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
|
import { IFeatureFlagValue } from '../../hooks/featureFlag/IFeatureFlagValue';
|
||||||
import { IAppContextState } from './IAppContextState';
|
import { IAppContextState } from './IAppContextState';
|
||||||
|
|
||||||
export type Action = { type: 'SET_FEATURE_FLAGS'; payload: unknown[] };
|
export type Action = {
|
||||||
|
type: 'SET_FEATURE_FLAGS';
|
||||||
|
payload: IFeatureFlagValue[];
|
||||||
|
};
|
||||||
|
|
||||||
export const reducer = (
|
export const reducer = (
|
||||||
state: IAppContextState,
|
state: IAppContextState,
|
||||||
|
|||||||
Reference in New Issue
Block a user