Skip to content

Commit

Permalink
Update site setup and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kazlauskis committed Nov 28, 2024
1 parent 00989f7 commit a98565e
Show file tree
Hide file tree
Showing 24 changed files with 970 additions and 314 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
## 1.27.0

Updated fixed site setup form.

## 1.26.6

Fixed moth trap edit form.
Updated species dictionary.
Bug fixes.

## 1.26.5

Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "uk.ac.ceh.ebms",
"title": "ButterflyCount",
"description": "ButterflyCount mobile application.",
"version": "1.26.6",
"version": "1.27.0",
"homepage": "http://www.butterfly-monitoring.net",
"scripts": {
"prepare": "husky",
Expand Down Expand Up @@ -40,7 +40,7 @@
"@capacitor/status-bar": "6.0.1",
"@flumens/bigu": "0.4.0",
"@flumens/ionic": "2.0.0-alpha.64.1",
"@flumens/tailwind": "0.19.1",
"@flumens/tailwind": "0.21.0",
"@heroicons/react": "^2.2.0",
"@hookform/resolvers": "^3.9.1",
"@ionic-native/core": "5.36.0",
Expand Down Expand Up @@ -72,7 +72,6 @@
"mobx": "^6.13.5",
"mobx-react": "9.1.1",
"mobx-utils": "6.1.0",
"prop-types": "15.8.1",
"react": "18.3.1",
"react-aria-components": "^1.4.1",
"react-autosuggest": "10.1.0",
Expand Down Expand Up @@ -107,6 +106,7 @@
"@flumens/fetch-onedrive-excel": "0.3.3",
"@flumens/prettier-config": "0.4.0",
"@flumens/webpack-config": "5.5.0",
"@types/geojson": "^7946.0.14",
"@types/jest": "29.5.14",
"@types/lodash": "^4.17.13",
"@types/react": "18.3.12",
Expand Down
42 changes: 27 additions & 15 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { observer } from 'mobx-react';
import { Route, Redirect } from 'react-router-dom';
import { TailwindContext, TailwindContextValue } from '@flumens';
import {
TailwindBlockContext,
TailwindContext,
TailwindContextValue,
defaultContext,
} from '@flumens';
import {
IonApp as IonAppPlain,
IonRouterOutlet,
Expand All @@ -24,6 +29,11 @@ const IonApp = IonAppPlain as any; // IonApp has 'lang' prop missing.

const platform = isPlatform('ios') ? 'ios' : 'android';
const tailwindContext: TailwindContextValue = { platform };
const tailwindBlockContext = {
...defaultContext,
...tailwindContext,
basePath: '',
};

const HomeRedirect = () => <Redirect to="home" />;

Expand All @@ -34,20 +44,22 @@ const App = () => {
<IonApp lang={language as any}>
<LanguageCountrySelectRequired appModel={appModel}>
<TailwindContext.Provider value={tailwindContext}>
<Onboarding>
<WhatsNewDialog appModel={appModel} />
<IonReactRouter>
<IonRouterOutlet id="main">
<Route exact path="/" component={HomeRedirect} />
<Route path="/home" component={Home} />
{Info}
{User}
{Survey}
{Location}
{Settings}
</IonRouterOutlet>
</IonReactRouter>
</Onboarding>
<TailwindBlockContext.Provider value={tailwindBlockContext}>
<Onboarding>
<WhatsNewDialog appModel={appModel} />
<IonReactRouter>
<IonRouterOutlet id="main">
<Route exact path="/" component={HomeRedirect} />
<Route path="/home" component={Home} />
{Info}
{User}
{Survey}
{Location}
{Settings}
</IonRouterOutlet>
</IonReactRouter>
</Onboarding>
</TailwindBlockContext.Provider>
</TailwindContext.Provider>
</LanguageCountrySelectRequired>
</IonApp>
Expand Down
8 changes: 2 additions & 6 deletions src/Info/About/index.jsx → src/Info/About/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import PropTypes from 'prop-types';
import { Trans as T } from 'react-i18next';
import { Page, Main, Header, Section } from '@flumens';
import appModel from 'models/app';
import './styles.scss';

const { P } = Section;

const Component = ({ appModel }) => {
const Component = () => {
const isEnglish = appModel.attrs.language === 'en';

return (
Expand Down Expand Up @@ -71,8 +71,4 @@ const Component = ({ appModel }) => {
);
};

Component.propTypes = {
appModel: PropTypes.object.isRequired,
};

export default Component;
4 changes: 1 addition & 3 deletions src/Info/router.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { Route } from 'react-router-dom';
import appModel from 'models/app';
import About from './About';
import Credits from './Credits';
import Guide from './Guide';
import Help from './Help';

const AboutWrap = () => <About appModel={appModel} />;
export default [
<Route path="/info/help" key="/info/help" exact component={Help} />,
<Route path="/info/credits" key="/info/credits" exact component={Credits} />,
<Route path="/info/about" key="/info/about" exact component={AboutWrap} />,
<Route path="/info/about" key="/info/about" exact component={About} />,
<Route path="/info/guide" key="/info/guide" exact component={Guide} />,
];
6 changes: 3 additions & 3 deletions src/Location/MothTrap/Home/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ type Props = {
deleteLamp: (lamp: Lamp) => void;
};

const MothTrapSetupMain = ({ location, addNewLamp, deleteLamp }: Props) => {
const { type, lamps, location: loc, typeOther } = location.attrs;
const MothTrapHomeMain = ({ location, addNewLamp, deleteLamp }: Props) => {
const { type, lamps = [], location: loc = {}, typeOther } = location.attrs;

const { t } = useTranslation();

Expand Down Expand Up @@ -150,4 +150,4 @@ const MothTrapSetupMain = ({ location, addNewLamp, deleteLamp }: Props) => {
);
};

export default observer(MothTrapSetupMain);
export default observer(MothTrapHomeMain);
4 changes: 4 additions & 0 deletions src/Location/MothTrap/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ const MothTrapSetup = ({ sample: location }: Props) => {
const addNewLamp = () => {
const cid = UUID();

if (!location.attrs.lamps) {
location.attrs.lamps = [];
}

location.attrs.lamps.push({
cid,
attrs: { type: '', quantity: 1, description: '' },
Expand Down
4 changes: 2 additions & 2 deletions src/Location/MothTrap/Lamp/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Props = {
lamp: Lamp;
};

const MothTrapSetupMain = ({ location, lamp }: Props) => {
const MothTrapLampMain = ({ location, lamp }: Props) => {
const { description, type } = lamp.attrs;

const getCounterOnChange = (value: number) => {
Expand Down Expand Up @@ -57,4 +57,4 @@ const MothTrapSetupMain = ({ location, lamp }: Props) => {
);
};

export default observer(MothTrapSetupMain);
export default observer(MothTrapLampMain);
2 changes: 1 addition & 1 deletion src/Survey/AreaCount/Area/Main/Favourites/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const Favourites = ({
</IonToolbar>

{hasGroup && (
<IonToolbar className=" !p-0 text-black [--background:var(--ion-page-background)]">
<IonToolbar className="!p-0 text-black [--background:var(--ion-page-background)]">
<IonSegment onIonChange={onSegmentClick} value={segment}>
<IonSegmentButton value="group">
<IonLabel className="ion-text-wrap">
Expand Down
Loading

0 comments on commit a98565e

Please sign in to comment.