Fix resources calendar view
This commit is contained in:
parent
6d99ca594a
commit
efaa22a8f1
@ -7,6 +7,8 @@ const ResourcesList: React.FC = () => {
|
|||||||
const [resources, setResources] = useState<Resource[]>([]);
|
const [resources, setResources] = useState<Resource[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const api = new SimpleLibreBookingClient();
|
const api = new SimpleLibreBookingClient();
|
||||||
@ -15,8 +17,7 @@ const ResourcesList: React.FC = () => {
|
|||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const resourcesData = await api.getResources();
|
const resourcesData = await api.getResources();
|
||||||
console.log('Resources loaded:', resourcesData);
|
|
||||||
console.log('Resources count:', resourcesData.length);
|
|
||||||
setResources(resourcesData);
|
setResources(resourcesData);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error loading resources:', err);
|
console.error('Error loading resources:', err);
|
||||||
@ -73,9 +74,11 @@ const ResourcesList: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))', gap: '1.5rem' }}>
|
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))', gap: '1.5rem' }}>
|
||||||
{resources.map((resource) => (
|
{resources.map((resource) => {
|
||||||
|
const resourceId = resource.resourceId || resource.id;
|
||||||
|
return (
|
||||||
<div
|
<div
|
||||||
key={resource.id}
|
key={resource.resourceId || resource.id}
|
||||||
style={{
|
style={{
|
||||||
border: '1px solid #ddd',
|
border: '1px solid #ddd',
|
||||||
borderRadius: '8px',
|
borderRadius: '8px',
|
||||||
@ -141,7 +144,7 @@ const ResourcesList: React.FC = () => {
|
|||||||
|
|
||||||
<div style={{ display: 'flex', gap: '0.75rem', marginTop: '1rem' }}>
|
<div style={{ display: 'flex', gap: '0.75rem', marginTop: '1rem' }}>
|
||||||
<Link
|
<Link
|
||||||
to={`/resources/${resource.id}/calendar`}
|
to={`/resources/${resourceId}/calendar`}
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
display: 'inline-block',
|
display: 'inline-block',
|
||||||
@ -173,8 +176,9 @@ const ResourcesList: React.FC = () => {
|
|||||||
Book Now
|
Book Now
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user