Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
strategy:
fail-fast: false
matrix:
app: [tictactogether, stocksync, orderup, cowrite, outagenet, yardgate, eventfloor]
app: [tictactogether, stocksync, orderup, cowrite, outagenet, yardgate, eventfloor, agrimesh]
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
Expand Down Expand Up @@ -89,6 +89,8 @@ jobs:
scheme: YardGate
- app: eventfloor
scheme: EventFloor
- app: agrimesh
scheme: AgriMesh
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ accounts or server, and shows a different way to keep shared state in sync.
| OutageNet | [`apps/outagenet`](./apps/outagenet) | Public-sector style outage coordination: status + handoff accept over Bluetooth, mock HQ sync with idempotent ingest. |
| YardGate | [`apps/yardgate`](./apps/yardgate) | Logistics yard check-in: MeshServices discover + invoke, gate officer approve/deny, optional relay hop. |
| Event Floor | [`apps/eventfloor`](./apps/eventfloor) | Live events: Flow A staff MLS dispatch + Flow B gate admission ledger and mock platform sync (`scanId` dedupe). |
| AgriMesh | [`apps/agrimesh`](./apps/agrimesh) | Agriculture: field readings store-and-forward over multi-hop Bluetooth mesh, office-edge ledger, mock farm sync (`readingId` dedupe). |

Each app's README explains how to run it, how its sync works and what its tests cover.

Expand Down Expand Up @@ -78,7 +79,7 @@ pnpm --filter @offline-app-examples/stocksync ios -- --device
pnpm --filter @offline-app-examples/stocksync android
```

Replace `stocksync` with `tictactogether`, `orderup`, `cowrite`, `outagenet`, `yardgate`, or `eventfloor` for the other apps.
Replace `stocksync` with `tictactogether`, `orderup`, `cowrite`, `outagenet`, `yardgate`, `eventfloor`, or `agrimesh` for the other apps.

### Event Floor

Expand Down
4 changes: 4 additions & 0 deletions apps/agrimesh/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native',
};
16 changes: 16 additions & 0 deletions apps/agrimesh/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
node_modules/
.expo/
dist/
build/
ios/Pods/
ios/build/
android/app/build/
android/build/
android/.gradle/
**/.cxx/
android/local.properties
*.jsbundle
.DS_Store
.env*
!.env.example
ios/.xcode.env.local
1 change: 1 addition & 0 deletions apps/agrimesh/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"singleQuote":true,"trailingComma":"all","bracketSpacing":true}
126 changes: 126 additions & 0 deletions apps/agrimesh/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import '@offline-app-examples/ui/global.css';
import { Button, Text } from '@offline-app-examples/ui';
import React, { useState } from 'react';
import { Pressable, StatusBar, TextInput, View } from 'react-native';
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
import { AgriFlow, type AgriRole } from './src/flows/AgriFlow';
import { DEMO_FARM } from './src/domain/plots';
import { AgriHero } from './src/ui/illustrations';

type Setup = { role: AgriRole; displayName: string };

export default function App() {
const [setup, setSetup] = useState<Setup | null>(null);

if (setup) {
return (
<SafeAreaProvider>
<StatusBar barStyle="dark-content" />
<AgriFlow
role={setup.role}
displayName={setup.displayName}
onLeave={() => setSetup(null)}
/>
</SafeAreaProvider>
);
}

return (
<SafeAreaProvider>
<StatusBar barStyle="dark-content" />
<HomeLobby onStart={setSetup} />
</SafeAreaProvider>
);
}

function HomeLobby({ onStart }: { onStart: (setup: Setup) => void }) {
const [role, setRole] = useState<AgriRole>('office');
const [name, setName] = useState('North office edge');

const defaults: Record<AgriRole, string> = {
office: 'North office edge',
field: 'Plot walker A',
relay: 'Field relay',
};

return (
<SafeAreaView className="bg-background flex-1" edges={['top', 'left', 'right']}>
<View className="flex-1 px-6 pt-4">
<Text className="font-serif text-4xl">AgriMesh</Text>
<Text className="text-muted-foreground mt-2 text-base leading-6">
{DEMO_FARM.name} — field readings hop across Bluetooth mesh to the farm office edge,
then sync once to a mock farm system (SDK 0.27).
</Text>
<View className="my-6 items-center">
<AgriHero size={160} />
</View>
<RolePick
options={[
{
id: 'office',
title: 'Office edge',
hint: 'Hosts the batch ledger; uploads when online',
},
{
id: 'field',
title: 'Field collector',
hint: 'Logs readings; proposes batches over mesh',
},
{
id: 'relay',
title: 'Relay worker',
hint: 'Store-and-forward hop between field and office',
},
]}
selected={role}
onSelect={(id) => {
const r = id as AgriRole;
setRole(r);
setName(defaults[r]);
}}
/>
<Text className="text-muted-foreground mb-2 text-xs font-bold uppercase tracking-widest">
Device label
</Text>
<TextInput
className="border-foreground text-foreground mb-4 rounded-lg border-2 px-3 py-3"
value={name}
onChangeText={setName}
placeholder={defaults[role]}
/>
<Button
onPress={() =>
onStart({ role, displayName: name.trim() || defaults[role] })
}
>
<Text>Start</Text>
</Button>
</View>
</SafeAreaView>
);
}

function RolePick({
options,
selected,
onSelect,
}: {
options: { id: string; title: string; hint: string }[];
selected: string;
onSelect: (id: string) => void;
}) {
return (
<View className="my-4 gap-2">
{options.map((o) => (
<Pressable
key={o.id}
onPress={() => onSelect(o.id)}
className={`rounded-xl border-2 px-4 py-3 ${selected === o.id ? 'border-foreground bg-muted' : 'border-muted'}`}
>
<Text className="font-serif text-xl">{o.title}</Text>
<Text className="text-muted-foreground text-sm">{o.hint}</Text>
</Pressable>
))}
</View>
);
}
17 changes: 17 additions & 0 deletions apps/agrimesh/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '~> 1.16.0'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '>= 1.25.0', '< 1.28.0'
gem 'concurrent-ruby', '< 1.3.4'

# Ruby 3.4.0 has removed some libraries from the standard library.
gem 'bigdecimal'
gem 'logger'
gem 'benchmark'
gem 'mutex_m'
gem 'nkf'
Loading
Loading