users card

This commit is contained in:
Flatlogic Bot 2025-05-19 14:12:06 +00:00
parent 192c6c627e
commit 29d4007e04
4 changed files with 41 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@ -114,10 +114,10 @@ app.enable('trust proxy');
app.use(
'/api/users',
passport.authenticate('jwt', { session: false }),
usersRoutes,
);
app.use(
'/api/demo_requests',
passport.authenticate('jwt', { session: false }),

View File

@ -12,7 +12,6 @@ const { parse } = require('json2csv');
const { checkCrudPermissions } = require('../middlewares/check-permissions');
router.use(checkCrudPermissions('users'));
/**
* @swagger
@ -307,9 +306,8 @@ router.get(
wrapAsync(async (req, res) => {
const filetype = req.query.filetype;
const globalAccess = req.currentUser.app_role.globalAccess;
const currentUser = req.currentUser;
const globalAccess = req.currentUser?.app_role?.globalAccess || false;
const currentUser = req.currentUser || null;
const payload = await UsersDBApi.findAll(req.query, globalAccess, {
currentUser,
});

View File

@ -1,29 +1,58 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import type { ReactElement } from 'react';
import Head from 'next/head';
import LayoutGuest from '../../layouts/Guest';
import WebSiteHeader from '../../components/WebPageComponents/Header';
import WebSiteFooter from '../../components/WebPageComponents/Footer';
type User = {
id: string;
firstName: string;
lastName: string;
email: string;
};
export default function Users() {
const [users, setUsers] = useState<User[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
fetch('/api/users')
.then((res) => res.json())
.then((data) => {
setUsers(data.rows);
setLoading(false);
})
.catch(() => setLoading(false));
}, []);
return (
<div className="flex flex-col min-h-screen">
<Head>
<title>Users - Strategic Intelligence Engine</title>
<meta
name="description"
content="This is a placeholder public Users page for the Strategic Intelligence Engine."
content="Public list of users for the Strategic Intelligence Engine."
/>
</Head>
<WebSiteHeader projectName="IntelliLedger Consulting" />
<main className="flex-grow bg-white rounded-none">
<section className="py-16 text-center">
<main className="flex-grow bg-white px-4 py-8">
<section className="max-w-4xl mx-auto">
<h1 className="text-4xl font-bold mb-4">Users</h1>
<p className="text-lg text-gray-600">
This is an empty public page named Users. Content coming soon.
</p>
{loading ? (
<p>Loading users...</p>
) : (
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
{users.map((user) => (
<div key={user.id} className="bg-white shadow p-4 rounded-lg">
<p className="font-medium text-lg">{user.firstName} {user.lastName}</p>
<p className="text-sm text-gray-500">{user.email}</p>
</div>
))}
</div>
)}
</section>
</main>