Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend styling refactor / UI polish #478

Merged
merged 26 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1d474e0
Adjust praise layout
kristoferlund Jun 6, 2022
0d68d25
Merge branch 'main' into fix/praise_layout
kristoferlund Jun 15, 2022
6eecc11
Remove unnecessary ActivePeriodMessage
kristoferlund Jun 15, 2022
329b0f8
WIP
kristoferlund Jun 15, 2022
57554d7
WIP
kristoferlund Jun 16, 2022
772a79b
WIP
kristoferlund Jun 16, 2022
41f1336
WIP
kristoferlund Jun 17, 2022
3ae9d95
FInishing up, there are lots more to do!
kristoferlund Jun 17, 2022
aba0fd6
Cleanup UserPopover
kristoferlund Jun 17, 2022
08bd4f2
Fix: Correctly detect Praise row clicks
kristoferlund Jun 17, 2022
ab80984
Add: SourceName component
kristoferlund Jun 17, 2022
88d0233
Fix: Better Praise layout on small screens
kristoferlund Jun 17, 2022
5dd70b1
Fix: Nav font size
kristoferlund Jun 17, 2022
03a0f38
Add missing colors
kristoferlund Jun 20, 2022
5d28cc1
Bring back dialog overlay
kristoferlund Jun 20, 2022
2fb0616
classNames
kristoferlund Jun 20, 2022
7f9dcca
Add: nameRealized to UserAccountDto
kristoferlund Jun 20, 2022
836c1a4
Nav fixes
kristoferlund Jun 20, 2022
0724409
Remove 'null' return
kristoferlund Jun 20, 2022
1f661e6
Nav styling and use of `dark:` modifier
kristoferlund Jun 20, 2022
5c556a4
Use classNames in EventLogList
kristoferlund Jun 20, 2022
12a39c7
CSS `gray` -> `warm-gray`
kristoferlund Jun 20, 2022
6b78f49
Close period outline button
kristoferlund Jun 20, 2022
78dc8da
Merge branch 'main' into refactor/ui_polish
kristoferlund Jun 20, 2022
5374145
Merge branch 'main' into fix/praise_layout
kristoferlund Jun 20, 2022
1746e89
Fix: shortenEthAddress import location
kristoferlund Jun 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
1 change: 1 addition & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@emotion/styled": "^11.6.0",
"@ethersproject/providers": "^5.5.3",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-brands-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.0.0",
"@fortawesome/react-fontawesome": "^0.1.17",
"@headlessui/react": "^1.4.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/BreadCrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface BreadCrumbProps {
}
const BreadCrumb = ({ name, icon }: BreadCrumbProps): JSX.Element => {
return (
<div className="mb-4 text-sm">
<div className="inline-block px-4 py-2 mb-4 text-xs rounded-full bg-warm-gray-50 dark:bg-slate-600">
<h3>
<FontAwesomeIcon
icon={icon}
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/InlineLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const InlineLabel = ({
onClick={onClick}
className={classNames(
className,
'h-6 pl-1 pr-1 mr-1 whitespace-nowrap text-xs text-white no-underline bg-gray-800 py-[1px] rounded',
'h-6 pl-1 pr-1 mr-1 whitespace-nowrap text-xs text-white no-underline bg-warm-gray-800 py-[1px] rounded',
onClick ? 'cursor-pointer' : ''
)}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/InlineLabelClosable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const InlineLabelClosable = ({
onClick={onClick}
className={classNames(
className,
'h-6 pl-1 pr-1 mr-1 text-xs text-white no-underline bg-gray-800 py-[1px] rounded',
'h-6 pl-1 pr-1 mr-1 text-xs text-white no-underline bg-warm-gray-800 py-[1px] rounded',
onClick ? 'cursor-pointer' : ''
)}
>
Expand Down
10 changes: 8 additions & 2 deletions packages/frontend/src/components/Notice.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { classNames } from '../utils';

interface Params {
children?: JSX.Element;
type?: string;
Expand All @@ -18,12 +20,16 @@ const Notice = ({
} else if (type === 'warning') {
typeClasses = 'bg-orange-300';
} else if (type === 'info') {
typeClasses = 'bg-gray-300';
typeClasses = 'bg-warm-gray-300 dark:bg-slate-700';
}

return (
<div
className={`w-full p-4 text-center text-white rounded-sm ${className} ${typeClasses}`}
className={classNames(
'w-full p-4 text-center text-white rounded-sm',
className,
typeClasses
)}
>
{children}
</div>
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/src/components/ScrollableDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ const ScrollableDialog = ({
if (!open) return null;

return (
<div className="absolute top-0 left-0 w-full h-full z-20">
<div className="absolute top-0 left-0 z-20 w-full h-full">
<div className="fixed w-full h-screen">
<div className="flex items-center justify-center w-full h-full bg-gray-800 bg-opacity-30">
<div className="flex items-center justify-center w-full h-full bg-warm-gray-800 bg-opacity-30">
<OutsideClickHandler onOutsideClick={onClose} active={open}>
<div className="z-30 max-w-xl bg-white rounded">
<div className="pb-16 bg-white rounded">{children}</div>
<div className="z-30 max-w-xl praise-box-defaults">
<div className="pb-16">{children}</div>
</div>
</OutsideClickHandler>
</div>
Expand Down
6 changes: 5 additions & 1 deletion packages/frontend/src/components/account/EthAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { faAngleDown, faAngleRight } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useState } from 'react';
import EthAccountDialog from './EthAccountDialog';
import { classNames } from '@/utils/index';

interface EthAccountParams {
className?: string;
Expand All @@ -25,7 +26,10 @@ export default function EthAccount({
return (
<>
<div
className={`flex justify-between items-center cursor-pointer ${className}`}
className={classNames(
'flex justify-between items-center cursor-pointer',
className
)}
kristoferlund marked this conversation as resolved.
Show resolved Hide resolved
onClick={(): void => setIsDialogOpen(true)}
>
<div className="flex items-center space-x-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ const EthAccountDialog = ({
initialFocus={contentRef}
>
<div className="flex items-center justify-center min-h-screen">
<Dialog.Overlay className="fixed inset-0 bg-gray-800 opacity-30" />
<div
className="relative max-w-xl p-6 mx-auto bg-white rounded dark:bg-slate-900"
ref={contentRef}
>
<div className="p-10 praise-box-defaults" ref={contentRef}>
kristoferlund marked this conversation as resolved.
Show resolved Hide resolved
<div className="flex justify-end">
<button className="praise-button-round" onClick={onClose}>
<FontAwesomeIcon icon={faTimes} size="1x" />
Expand Down
5 changes: 1 addition & 4 deletions packages/frontend/src/components/auth/SignMessageButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ const SignMessageButton = ({
return isLoading || isSuccess ? (
<LoaderSpinner />
) : (
<button
className="px-4 py-2 font-bold text-white bg-gray-800 rounded hover:bg-gray-700"
onClick={(): void => signMessage()}
>
<button className="praise-button" onClick={(): void => signMessage()}>
{text}
</button>
);
Expand Down
48 changes: 26 additions & 22 deletions packages/frontend/src/components/eventlog/EventLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import { EventLogDto, EventLogTypeKey } from 'api/dist/eventlog/types';
import { SingleUser } from '@/model/users';
import { useRecoilValue } from 'recoil';
import { InlineLabel } from '../InlineLabel';
import { UserDto } from 'api/dist/user/types';
import { UserAccountDto } from 'api/dist/useraccount/types';
import Notice from '../Notice';
import { Tooltip } from '@mui/material';
import { classNames } from '@/utils/index';
import { UserName } from '../user/UserName';
import { UserPopover } from '../user/UserPopover';

const eventLogTypeColors = {
[EventLogTypeKey.PERMISSION]: 'bg-orange-400',
Expand All @@ -22,19 +23,6 @@ const eventLogTypeColors = {
[EventLogTypeKey.SETTING]: 'bg-indigo-400',
};

const getEventLogUsername = (
user: UserDto | undefined,
useraccount: UserAccountDto | undefined
): string | undefined => {
if (user) {
return user.nameRealized;
} else if (useraccount) {
return useraccount.name;
} else {
return undefined;
}
};

interface Params {
eventlog: EventLogDto;
className?: string;
Expand All @@ -43,16 +31,32 @@ interface Params {
const EventLog = ({ eventlog, className = '' }: Params): JSX.Element | null => {
const user = useRecoilValue(SingleUser(eventlog.user));

console.log(eventlog);

return (
<div className={`flex items-center w-full ${className}`}>
<div className="flex items-center">
<UserAvatar userAccount={eventlog.useraccount} user={user} />
<div className={classNames('flex items-center w-full', className)}>
<div className="flex items-center text-2xl">
<UserPopover
user={user}
userAccount={eventlog.useraccount}
className="inline-block"
>
<UserAvatar userAccount={eventlog.useraccount} user={user} />
</UserPopover>
kristoferlund marked this conversation as resolved.
Show resolved Hide resolved
</div>
<div className="flex-grow p-3 overflow-hidden">
<div>
<span className="font-bold">
{getEventLogUsername(user, eventlog.useraccount)}
</span>
<UserPopover
user={user}
userAccount={eventlog.useraccount}
className="inline-block"
>
<UserName
user={user}
userAccount={eventlog.useraccount}
className="font-bold"
/>
</UserPopover>
<Tooltip
placement="right-end"
title={`${formatIsoDateUTC(
Expand All @@ -61,7 +65,7 @@ const EventLog = ({ eventlog, className = '' }: Params): JSX.Element | null => {
)} UTC`}
arrow
>
<span className="ml-2 text-xs text-gray-500">
<span className="ml-2 text-xs text-gray-300">
{localizeAndFormatIsoDate(eventlog.createdAt)}
</span>
</Tooltip>
Expand Down
7 changes: 4 additions & 3 deletions packages/frontend/src/components/form/DayInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import OutsideClickHandler from '@/components/OutsideClickHandler';
import { useState } from 'react';
import { DayPicker, useInput } from 'react-day-picker';
import 'react-day-picker/dist/style.css';
import { classNames } from '@/utils/index';

interface Params {
name: string;
Expand Down Expand Up @@ -37,8 +38,8 @@ const DayInput = ({
};

return (
<div className={`w-full ${className}`}>
<div className="flex justify-start items-center">
<div className={classNames('w-full', className)}>
<div className="flex items-center justify-start">
<input
{...inputProps}
type="text"
Expand All @@ -59,7 +60,7 @@ const DayInput = ({
>
<DayPicker
{...dayPickerProps}
className="absolute mt-1 p-2 border text-xs rounded-lg shadow-lg bg-gray-50 z-20"
className="absolute z-20 p-2 mt-1 text-xs border rounded-lg shadow-lg bg-warm-gray-50"
onDayClick={handleDayClick}
selected={parseDate(value)}
/>
kristoferlund marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/form/ImageFileInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const ImageFileInput = (name: string, src: string | undefined): JSX.Element => {
{src ? (
<img src={src} className="block w-auto h-48" />
) : (
<div className="block w-auto h-48 bg-gray-300 "></div>
<div className="block w-auto h-48 bg-warm-gray-300 "></div>
)}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/form/MultiselectInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const MultiselectInput = ({
key={filterIdx}
className={({ active }): string =>
`relative cursor-default select-none py-2 pl-10 pr-4 ${
active ? 'bg-gray-100 text-gray-900' : 'text-gray-600'
active ? 'bg-warm-gray-100 text-gray-900' : 'text-gray-600'
}`
}
value={filter}
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/components/form/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const SearchInput = ({
return (
<div className="relative flex items-center border border-gray-400 h-[42px]">
<div className="absolute inset-y-0 left-0 flex items-center pl-3">
<span className="text-gray-800">
<span className="text-gray-800 dark:text-white">
<FontAwesomeIcon
icon={faMagnifyingGlass}
size="1x"
Expand All @@ -22,7 +22,7 @@ const SearchInput = ({
</span>
</div>
<input
className="h-[42px] block pl-8 bg-transparent border-none outline-none focus:ring-0"
className="block pl-8 bg-transparent border-none outline-none focus:ring-0"
name="search"
type="text"
placeholder="Search"
Expand Down
10 changes: 6 additions & 4 deletions packages/frontend/src/components/form/SelectInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const SelectInput = ({
return (
<div className="relative w-40 h-[42px]">
<Listbox value={selected} onChange={handleChange}>
<Listbox.Button className="h-[42px] border border-gray-400 w-full py-1.5 pl-3 pr-10 text-left bg-transparent ">
<Listbox.Button className="h-[42px] border border-gray-400 w-full py-1.5 pl-3 pr-10 text-left bg-transparent ">
<span className="block truncate">{selected.label}</span>
<div className="absolute inset-y-0 right-0 flex items-center pr-3">
<span className="text-gray-800 ">
Expand All @@ -39,13 +39,15 @@ const SelectInput = ({
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<Listbox.Options className="absolute w-full py-1 mt-1 overflow-auto bg-white border border-gray-400 max-h-60">
<Listbox.Options className="absolute w-full py-1 mt-1 overflow-auto bg-white border border-gray-400 max-h-60 dark:bg-slate-600">
{options.map((s, sIdx) => (
<Listbox.Option
key={sIdx}
className={({ active }): string =>
`relative cursor-default select-none py-2 pl-4 pr-4 ${
active ? 'bg-gray-100 text-gray-900' : 'text-gray-600'
`relative cursor-default select-none py-2 pl-4 pr-4 ${
active
? 'bg-warm-gray-100 dark:bg-slate-700 text-gray-900 dark:text-white'
: 'text-gray-600 dark:text-white'
}`
}
value={s}
Expand Down
25 changes: 13 additions & 12 deletions packages/frontend/src/components/periods/ActiveNoticesBoard.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { ActivePeriodMessage } from './ActivePeriodMessage';
import { ActiveUserQuantificationsMessage } from './ActiveUserQuantificationsMessage';
import { Suspense } from 'react';

export const ActiveNoticesBoard = (): JSX.Element | null => {
const activePeriodMessageRender = ActivePeriodMessage({});

export const ActiveNoticesBoardInner = (): JSX.Element | null => {
const activeUserQuantificationMessageRender =
ActiveUserQuantificationsMessage();

if (!activePeriodMessageRender && !activeUserQuantificationMessageRender)
return null;
if (!activeUserQuantificationMessageRender) return null;

return (
<div className="praise-box">
<Suspense fallback="Loading…">
{activePeriodMessageRender && activePeriodMessageRender}
{activeUserQuantificationMessageRender &&
activeUserQuantificationMessageRender}
</Suspense>
<div className="mb-5 praise-box">
{activeUserQuantificationMessageRender &&
activeUserQuantificationMessageRender}
</div>
);
};

export const ActiveNoticesBoard = (): JSX.Element | null => {
return (
<Suspense fallback={null}>
<ActiveNoticesBoardInner />
</Suspense>
);
};
21 changes: 0 additions & 21 deletions packages/frontend/src/components/periods/ActivePeriodMessage.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const ActiveUserQuantificationsMessage = (): JSX.Element | null => {
return null;

return (
<div className="mt-2">
<div>
Quantification is open! You can perform quantifications for the following
periods:
<ul className="list-disc list-inside">
Expand Down
Loading