-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
170 additions
and
191 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Influx\Http\Controllers; | ||
|
||
use Inertia\Inertia; | ||
use Inertia\Response; | ||
use Influx\Models\User; | ||
use Illuminate\Http\Request; | ||
|
||
class UsersController extends Controller | ||
{ | ||
/** | ||
* Display the table holding all user accounts. | ||
*/ | ||
public function index(Request $request): Response | ||
{ | ||
return Inertia::render('Users/Index', [ | ||
'users' => User::all(), | ||
]); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
export default function Table({ children }: { children: ReactNode }) { | ||
return ( | ||
<table className="w-full text-left text-sm text-gray-500 rtl:text-right dark:text-gray-400"> | ||
{children} | ||
</table> | ||
); | ||
} | ||
|
||
export function Head({ columns }: { columns: string[] }) { | ||
return ( | ||
<thead className="bg-zinc-900 text-xs uppercase"> | ||
<tr> | ||
{columns.map((col) => ( | ||
<th scope="col" className="px-6 py-3" key={col}> | ||
{col} | ||
</th> | ||
))} | ||
</tr> | ||
</thead> | ||
); | ||
} | ||
|
||
export function Body({ children }: { children: ReactNode }) { | ||
return <tbody>{children}</tbody>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Body, Head } from '@/Components/Table'; | ||
import Authenticated from '@/Layouts/AuthenticatedLayout'; | ||
import { PageProps, User } from '@/types'; | ||
import Avatar from 'boring-avatars'; | ||
|
||
export default function Index({ users }: PageProps<{ users: User[] }>) { | ||
return ( | ||
<Authenticated title={'All Users'}> | ||
<table className="w-full text-left text-sm text-gray-400"> | ||
<Head columns={['Name', 'Position', 'Status', 'Action']} /> | ||
<Body> | ||
{users.map((user) => ( | ||
<tr | ||
className="duration-250 border-b border-gray-800 bg-zinc-800 transition dark:hover:bg-zinc-800/80" | ||
key={user.email} | ||
> | ||
<th | ||
scope="row" | ||
className="flex items-center whitespace-nowrap px-6 py-4" | ||
> | ||
<Avatar | ||
variant={'beam'} | ||
name={'EmailName'} | ||
className={'h-10 w-10'} | ||
/> | ||
<div className="ps-3"> | ||
<div className="text-base font-semibold"> | ||
{user.name} | ||
</div> | ||
<div className="font-normal text-gray-500"> | ||
{user.email} | ||
</div> | ||
</div> | ||
</th> | ||
<td className="px-6 py-4"> | ||
{user.superuser ? 'Superuser' : 'Standard'} | ||
</td> | ||
<td className="px-6 py-4"> | ||
<div className="flex items-center"> | ||
<div className="me-2 h-2.5 w-2.5 rounded-full bg-green-500"></div>{' '} | ||
Online | ||
</div> | ||
</td> | ||
<td className="px-6 py-4"> | ||
<a | ||
href={`/users/${user.id}`} | ||
className="font-medium text-blue-600 hover:underline dark:text-blue-500" | ||
> | ||
Edit | ||
</a> | ||
</td> | ||
</tr> | ||
))} | ||
</Body> | ||
</table> | ||
</Authenticated> | ||
); | ||
} |
Oops, something went wrong.