Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

add nice transitions & redesign empty state (no organisations component)

Blue Mouse4e7117ffb899
diff --git a/web/app/pages/Organisations/AddOrganisation.tsx b/web/app/pages/Organisations/AddOrganisation.tsx
index ace7408ed..85938585b 100644
--- a/web/app/pages/Organisations/AddOrganisation.tsx
+++ b/web/app/pages/Organisations/AddOrganisation.tsx
@@ -15,14 +15,17 @@ export const AddOrganisation = ({ onClick, sitesCount }: AddOrganisationProps) =
type='button'
onClick={onClick}
className={cx(
- 'group flex h-auto min-h-[153.1px] cursor-pointer items-center justify-center rounded-lg border-2 border-dashed border-gray-300 hover:border-gray-400',
+ 'group flex h-auto min-h-[153.1px] cursor-pointer items-center justify-center rounded-lg border border-dashed border-gray-300 transition-colors hover:border-gray-400 dark:border-gray-500 dark:hover:border-gray-600',
{
'lg:min-h-[auto]': sitesCount % 3 !== 0,
},
)}
>
<div>
- <BuildingOffice2Icon className='mx-auto h-12 w-12 text-gray-400 group-hover:text-gray-500 dark:text-gray-200 group-hover:dark:text-gray-400' />
+ <BuildingOffice2Icon
+ className='mx-auto h-12 w-12 text-gray-400 transition-colors group-hover:text-gray-500 dark:text-gray-200 group-hover:dark:text-gray-400'
+ strokeWidth={1}
+ />
<span className='mt-2 block text-sm font-semibold text-gray-900 dark:text-gray-50 group-hover:dark:text-gray-400'>
{t('organisations.new')}
</span>
diff --git a/web/app/pages/Organisations/NoOrganisations.tsx b/web/app/pages/Organisations/NoOrganisations.tsx
index c944e9149..55b7672e8 100644
--- a/web/app/pages/Organisations/NoOrganisations.tsx
+++ b/web/app/pages/Organisations/NoOrganisations.tsx
@@ -9,15 +9,21 @@ export const NoOrganisations = ({ onClick }: NoOrganisationsProps) => {
const { t } = useTranslation('common')
return (
- <button
- type='button'
- onClick={onClick}
- className='relative mx-auto block max-w-lg rounded-lg border-2 border-dashed border-gray-300 p-12 text-center hover:border-gray-400 focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:outline-hidden'
- >
- <BuildingOffice2Icon className='mx-auto h-12 w-12 text-gray-400 dark:text-gray-200' />
- <span className='mt-2 block text-sm font-semibold text-gray-900 dark:text-gray-50'>
- {t('dashboard.createProject')}
- </span>
- </button>
+ <div className='mx-auto w-full max-w-2xl py-16 text-center text-gray-900 dark:text-gray-50'>
+ <div className='mx-auto mb-6 flex size-14 items-center justify-center rounded-xl bg-gray-100 dark:bg-slate-800'>
+ <BuildingOffice2Icon className='size-7 text-gray-700 dark:text-gray-200' strokeWidth={1.5} />
+ </div>
+ <h3 className='text-xl font-medium tracking-tight'>{t('organisations.noOrganisations')}</h3>
+ <p className='mx-auto mt-2 max-w-md text-sm text-gray-600 dark:text-gray-300'>
+ {t('organisations.createOrganisation')}
+ </p>
+ <button
+ type='button'
+ onClick={onClick}
+ className='mt-6 rounded-md border border-transparent bg-slate-900 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-slate-700 dark:border-gray-800 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-slate-700'
+ >
+ {t('organisations.new')}
+ </button>
+ </div>
)
}
diff --git a/web/app/pages/Organisations/OrganisationCard.tsx b/web/app/pages/Organisations/OrganisationCard.tsx
index 59a24459f..3ad5c1695 100644
--- a/web/app/pages/Organisations/OrganisationCard.tsx
+++ b/web/app/pages/Organisations/OrganisationCard.tsx
@@ -118,9 +118,9 @@ export const OrganisationCard = ({ organisation, reloadOrganisations }: Organisa
to={_replace(routes.organisation, ':id', organisation.id)}
onClick={onElementClick}
className={cx(
- 'min-h-[153.1px] overflow-hidden rounded-xl border border-gray-200 bg-gray-50 dark:border-slate-800/25 dark:bg-slate-800',
+ 'min-h-[153.1px] overflow-hidden rounded-xl border border-gray-200 bg-gray-50 transition-colors dark:border-slate-800/25 dark:bg-slate-800/70',
{
- 'cursor-pointer hover:bg-gray-100 dark:hover:bg-slate-700': membership?.role !== 'viewer',
+ 'cursor-pointer hover:bg-gray-200/70 dark:hover:bg-slate-700/60': membership?.role !== 'viewer',
},
)}
>
@@ -132,7 +132,7 @@ export const OrganisationCard = ({ organisation, reloadOrganisations }: Organisa
// dummy button, since the whole card is clickable
<div
aria-label={`${t('project.settings.settings')} ${name}`}
- className='rounded-md p-1.5 text-gray-800 hover:bg-gray-50 hover:text-gray-900 dark:text-slate-400 dark:hover:bg-slate-700 dark:hover:text-slate-300'
+ className='rounded-md border border-transparent p-1.5 text-gray-800 transition-colors hover:border-gray-300 hover:bg-gray-50 hover:text-gray-900 dark:text-slate-400 hover:dark:border-slate-700/80 dark:hover:bg-slate-800 dark:hover:text-slate-300'
>
<Settings2Icon className='size-5' strokeWidth={1.5} />
</div>
diff --git a/web/app/pages/Organisations/Organisations.tsx b/web/app/pages/Organisations/Organisations.tsx
index a5e519c7a..779ffdf61 100644
--- a/web/app/pages/Organisations/Organisations.tsx
+++ b/web/app/pages/Organisations/Organisations.tsx
@@ -1,9 +1,10 @@
-import { MagnifyingGlassIcon, XMarkIcon, BuildingOffice2Icon } from '@heroicons/react/24/outline'
+import { BuildingOffice2Icon } from '@heroicons/react/24/outline'
import { XCircleIcon } from '@heroicons/react/24/solid'
import _isEmpty from 'lodash/isEmpty'
import _map from 'lodash/map'
import _size from 'lodash/size'
-import React, { useState, useEffect, useCallback } from 'react'
+import { SearchIcon, XIcon } from 'lucide-react'
+import React, { useState, useEffect, useCallback, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { Link } from 'react-router'
import { ClientOnly } from 'remix-utils/client-only'
@@ -31,6 +32,7 @@ const Organisations = () => {
const { t } = useTranslation('common')
const [isSearchActive, setIsSearchActive] = useState(false)
+ const searchInputRef = useRef<HTMLInputElement>(null)
const [showActivateEmailModal, setShowActivateEmailModal] = useState(false)
const [search, setSearch] = useState('')
const debouncedSearch = useDebounce<string>(search, 500)
@@ -178,36 +180,58 @@ const Organisations = () => {
<div className='mx-auto w-full max-w-7xl px-4 py-6 sm:px-6 lg:px-8'>
<div className='mb-6 flex flex-wrap justify-between gap-2'>
<div className='flex items-end justify-between'>
- <h2 className='mt-2 flex items-baseline text-3xl font-bold text-gray-900 dark:text-gray-50'>
- {t('titles.organisations')}
+ <h2 className='mt-2 flex items-baseline gap-2 text-3xl font-bold text-gray-900 dark:text-gray-50'>
+ <span>{t('titles.organisations')}</span>
{isSearchActive ? (
- <XMarkIcon
- className='ml-2 h-5 w-5 cursor-pointer text-gray-900 hover:opacity-80 dark:text-gray-50'
+ <button
+ className='rounded-md border border-transparent bg-gray-50 p-2 transition-colors hover:border-gray-300 hover:bg-white dark:bg-slate-900 hover:dark:border-slate-700/80 dark:hover:bg-slate-800'
+ type='button'
onClick={() => {
setSearch('')
setIsSearchActive(false)
}}
- />
+ aria-label={t('common.close')}
+ >
+ <XIcon
+ className='h-5 w-5 cursor-pointer rounded-md text-gray-900 dark:text-gray-50'
+ strokeWidth={1.5}
+ />
+ </button>
) : (
- <MagnifyingGlassIcon
- className='ml-2 h-5 w-5 cursor-pointer text-gray-900 hover:opacity-80 dark:text-gray-50'
+ <button
+ className='rounded-md border border-transparent bg-gray-50 p-2 transition-colors hover:border-gray-300 hover:bg-white dark:bg-slate-900 hover:dark:border-slate-700/80 dark:hover:bg-slate-800'
+ type='button'
onClick={() => {
setIsSearchActive(true)
+ setTimeout(() => {
+ searchInputRef.current?.focus()
+ }, 100)
}}
- />
+ aria-label={t('project.search')}
+ >
+ <SearchIcon
+ className='h-5 w-5 cursor-pointer rounded-md text-gray-900 dark:text-gray-50'
+ strokeWidth={1.5}
+ />
+ </button>
)}
</h2>
{isSearchActive ? (
- <div className='hidden w-full max-w-md items-center px-2 pb-1 sm:ml-5 sm:flex'>
- <label htmlFor='simple-search' className='sr-only'>
- Search
+ <div className='hidden w-full max-w-md items-center px-2 pb-1 sm:ml-2 sm:flex'>
+ <label htmlFor='organisation-search' className='sr-only'>
+ {t('project.search')}
</label>
<div className='relative w-full'>
<div className='pointer-events-none absolute inset-y-0 left-0 hidden items-center sm:flex'>
- <MagnifyingGlassIcon className='ml-2 h-5 w-5 cursor-pointer text-gray-900 hover:opacity-80 dark:text-gray-50' />
+ <SearchIcon
+ className='ml-2 h-5 w-5 cursor-pointer text-gray-900 hover:opacity-80 dark:text-gray-50'
+ strokeWidth={1.5}
+ />
</div>
<input
+ ref={searchInputRef}
type='text'
+ id='organisation-search'
onChange={onSearch}
value={search}
className='block h-7 w-full rounded-lg border-none bg-gray-50 p-2.5 text-sm text-gray-900 ring-1 ring-gray-300 focus:ring-gray-500 sm:pl-10 dark:bg-slate-900 dark:text-white dark:placeholder-gray-400 dark:ring-slate-600 dark:focus:ring-slate-200'
@@ -217,24 +241,29 @@ const Organisations = () => {
</div>
) : null}
</div>
- <span
+ <button
+ type='button'
onClick={onNewOrganisation}
- className='inline-flex cursor-pointer items-center justify-center rounded-md border border-transparent bg-slate-900 px-3 py-2 !pl-2 text-center text-sm leading-4 font-medium text-white hover:bg-slate-700 focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 focus:outline-hidden dark:border-gray-800 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-slate-700'
+ className='inline-flex cursor-pointer items-center justify-center rounded-md border border-transparent bg-slate-900 p-2 text-center text-sm leading-4 font-medium text-white transition-colors hover:bg-slate-700 focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 focus:outline-hidden dark:border-gray-800 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-slate-700'
>
<BuildingOffice2Icon className='mr-1 h-5 w-5' />
{t('organisations.new')}
- </span>
+ </button>
</div>
{isSearchActive ? (
<div className='mb-2 flex w-full items-center sm:hidden'>
- <label htmlFor='simple-search' className='sr-only'>
- Search
+ <label htmlFor='organisation-search-mobile' className='sr-only'>
+ {t('project.search')}
</label>
<div className='relative w-full'>
<div className='pointer-events-none absolute inset-y-0 left-0 flex items-center'>
- <MagnifyingGlassIcon className='ml-2 h-5 w-5 cursor-pointer text-gray-900 hover:opacity-80 dark:text-gray-50' />
+ <SearchIcon
+ className='ml-2 h-5 w-5 cursor-pointer text-gray-900 hover:opacity-80 dark:text-gray-50'
+ strokeWidth={1.5}
+ />
</div>
<input
+ id='organisation-search-mobile'
type='text'
onChange={onSearch}
value={search}