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