mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-11-01 02:39:26 -05:00
- Implement RecentActivity service to track recent planting, harvesting, and trading events. - Enhance TimelineService to include garden layouts in event queries. - Update navigation menu to include a link to friends and neighbours. - Create member card partial for displaying gardener information. - Add follow button partial for managing follow actions. - Refactor members index view to use the new member card partial. - Introduce neighbours feed view with daily updates and entries. - Implement entry partial for displaying individual neighbour activities. - Create layout partial for visualizing garden layouts. - Add posts section to neighbours view for displaying recent posts. - Implement reach section to show nearby gardeners. - Add suggestions section for recommending gardeners to follow. - Create routes for neighbours functionality and member dismissals. - Add migrations for member dismissals and garden layout timestamps. - Write feature and request specs for neighbours functionality. - Include support for creating located members in tests.
43 lines
1.8 KiB
React
43 lines
1.8 KiB
React
// Entry point for the React "islands": small React components mounted into
|
|
// server-rendered pages. Rails renders an empty element with
|
|
// data-react-component="Name" and data-props='{...}' (see the react_component
|
|
// helper); this finds each one and mounts the matching component.
|
|
//
|
|
// To add a component: create it in ./components and register it below.
|
|
import React from 'react';
|
|
import {createRoot} from 'react-dom/client';
|
|
|
|
import FeedMore from './components/FeedMore';
|
|
import GardenCards from './components/GardenCards';
|
|
import GardenLayout from './components/GardenLayout';
|
|
import GrowingTable from './components/GrowingTable';
|
|
import HarvestChart from './components/HarvestChart';
|
|
import LocationPicker from './components/LocationPicker';
|
|
import PhotoDialog from './components/PhotoDialog';
|
|
import PhotoPicker from './components/PhotoPicker';
|
|
import PlantPicker from './components/PlantPicker';
|
|
import PlantingPicker from './components/PlantingPicker';
|
|
import PlantingActions from './components/PlantingActions';
|
|
import PlantingRating from './components/PlantingRating';
|
|
|
|
const components = {FeedMore, GardenCards, GardenLayout, GrowingTable, HarvestChart, LocationPicker, PhotoDialog, PhotoPicker, PlantPicker, PlantingPicker, PlantingActions, PlantingRating};
|
|
|
|
function mountIslands() {
|
|
document.querySelectorAll('[data-react-component]').forEach((element) => {
|
|
const name = element.dataset.reactComponent;
|
|
const Component = components[name];
|
|
if (!Component) {
|
|
console.error(`No React component registered as "${name}"`);
|
|
return;
|
|
}
|
|
const props = JSON.parse(element.dataset.props || '{}');
|
|
createRoot(element).render(<Component {...props} />);
|
|
});
|
|
}
|
|
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', mountIslands);
|
|
} else {
|
|
mountIslands();
|
|
}
|