Skip to content

Commit

Permalink
Merge pull request #356 from commons-stack/style/responsiviness
Browse files Browse the repository at this point in the history
Improve dapp responsiviness
  • Loading branch information
kristoferlund authored Jun 7, 2022
2 parents d673095 + 819fb65 commit aa69367
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 32 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Improve dapp responsiviness #190 #356
- Opening dialog to mark praise as duplicate should place focus on input #80

## [0.8.0] - 2022-06-06

### Added
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/navigation/NavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const NavItem = ({ icon, description, to }: NavProps): JSX.Element => {
<FontAwesomeIcon icon={icon} size="1x" className="inline-block" />
</div>
)}
<div className="flex-auto inline-block my-1">
<span>{description}</span>
<div className="flex-auto inline-block my-1 whitespace-nowrap">
{description}
</div>
</NavLink>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/EventLogs/EventLogsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import EventLogsList from './components/EventLogsList';

const EventLogsPage = (): JSX.Element => {
return (
<div className="max-w-2xl mx-auto">
<div className="praise-page">
<BreadCrumb name="Transparency Log" icon={faBook} />

<div className="w-full praise-box overflow-x-auto">
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/FAQ/FAQPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const FAQPage = (): JSX.Element | null => {
if (!faq || !faq.length) return null;

return (
<div className="max-w-2xl mx-auto">
<div className="praise-page">
<BreadCrumb name="FAQ" icon={faQuestionCircle} />

<div className="w-full praise-box">
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/MyPraise/MyPraisePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import MyPraiseTable from './components/MyPraiseTable';

const MyPraise = (): JSX.Element => {
return (
<div className="max-w-2xl mx-auto">
<div className="praise-page">
<BreadCrumb name="My praise" icon={faPrayingHands} />

<ActiveNoticesBoard />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const getReceiverId = (user: UserDto | undefined): string | undefined => {
};

const MyPraiseTable = (): JSX.Element => {
const history = useHistory();
const allPraise = useRecoilValue(AllPraiseList(MY_PRAISE_LIST_KEY));
const userId = useRecoilValue(ActiveUserId);
const user = useRecoilValue(SingleUser(userId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const PeriodsForm = (): JSX.Element => {
value={input.value}
onChange={input.onChange}
className="w-72 block"
inputClassName="w-100"
/>
{apiResponse && (
<FieldErrorMessage
Expand All @@ -126,7 +127,7 @@ const PeriodsForm = (): JSX.Element => {

const PeriodsCreatePage = (): JSX.Element => {
return (
<div className="max-w-2xl mx-auto">
<div className="praise-page">
<BreadCrumb name="Quantification periods" icon={faCalendarAlt} />
<BackLink to="/periods" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ const PeriodDetailPage = (): JSX.Element | null => {
if (!period || !period.receivers) return null;

return (
<div className="max-w-2xl mx-auto">
<div className="praise-page">
<BreadCrumb name="Quantification periods" icon={faCalendarAlt} />
<BackLink to="/periods" />

<div className="max-w-4xl praise-box">
<div className="praise-box">
<React.Suspense fallback="Loading…">
<PeriodDetailHead />
</React.Suspense>
Expand All @@ -84,9 +84,9 @@ const PeriodDetailPage = (): JSX.Element | null => {
<QuantifierMessage />
</React.Suspense>

<div className="flex space-x-4">
<div className="flex sm:space-x-4 sm:flex-row flex-col">
<div>
<div className="w-40 py-5 mb-5 break-words border rounded-lg shadow-sm bg-gray-50">
<div className="w-full sm:w-40 py-5 mb-5 break-words border rounded-lg shadow-sm bg-gray-50">
<nav>
<NavItem
to={`${url}/receivers`}
Expand All @@ -107,7 +107,7 @@ const PeriodDetailPage = (): JSX.Element | null => {
</div>
</div>

<div className="w-full max-w-3xl praise-box">
<div className="praise-box w-full">
<Suspense fallback="Loading…">
<Switch>
<Route path={`${path}/receivers`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const PeriodDetails = (): JSX.Element | null => {
<PeriodDateForm />
<div className="mt-5">
{period.status === 'OPEN' || period.status === 'QUANTIFY' ? (
<div className="flex justify-between">
<div className="flex gap-4 justify-between">
{period.status === 'OPEN' &&
period.receivers &&
period?.receivers.length > 0 &&
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/Periods/PeriodsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import PeriodsTable from './components/Table';

const PeriodsPage = (): JSX.Element => {
return (
<div className="max-w-2xl mx-auto">
<div className="praise-page">
<BreadCrumb name="Quantification periods" icon={faCalendarAlt} />

<ActiveNoticesBoard />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const PraiseDetailsPage = (): JSX.Element | null => {
if (!praise) return null;

return (
<div className="max-w-2xl mx-auto">
<div className="praise-page">
<BreadCrumb name={'Praise details'} icon={faCalendarAlt} />
<BackLink to={backLinkUrl} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const QuantifyPeriodPage = (): JSX.Element => {
const { periodId } = useParams<PeriodPageParams>();

return (
<div className="max-w-2xl mx-auto">
<div className="praise-page">
<BreadCrumb name="Quantify" icon={faCalendarAlt} />
<BackLink to={`/periods/${periodId}`} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const QuantifyPeriodReceiverPage = (): JSX.Element => {
const { periodId, receiverId } = useParams<PeriodAndReceiverPageParams>();

return (
<div className="max-w-5xl mx-auto h-full">
<div className="praise-page h-full">
<React.Suspense fallback="Loading…">
<PeriodBreadCrumb />
</React.Suspense>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { faPrayingHands } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { PraiseDto } from 'api/dist/praise/types';
import { useCombobox } from 'downshift';
import React from 'react';
import React, { useEffect, useRef } from 'react';
import { useParams } from 'react-router-dom';
import { useRecoilValue } from 'recoil';

Expand All @@ -25,6 +25,8 @@ const PraiseAutosuggest = ({
onClose,
praise,
}: PraiseAutosuggestProps): JSX.Element | null => {
const inputRef = useRef<HTMLInputElement>(null);

const { periodId, receiverId } = useParams<PeriodAndReceiverPageParams>();
const userId = useRecoilValue(ActiveUserId);
const data = useRecoilValue(
Expand All @@ -36,6 +38,12 @@ const PraiseAutosuggest = ({
'PRAISE_QUANTIFY_RECEIVER_PSEUDONYMS'
) as boolean;

useEffect(() => {
if (inputRef && inputRef.current) {
inputRef.current.focus();
}
}, [inputRef]);

if (!data) return null;

const filteredData = data.filter(
Expand Down Expand Up @@ -93,7 +101,7 @@ const PraiseAutosuggest = ({
className="pl-10 text-sm w-80"
type="text"
placeholder="Search by praise id"
{...getInputProps()}
{...getInputProps({ ref: inputRef })}
/>
</div>
</div>
Expand Down
18 changes: 8 additions & 10 deletions packages/frontend/src/pages/Settings/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@ const SettingsPage = (): JSX.Element | null => {
);

return (
<div className="max-w-3xl mx-auto">
<div className="praise-page">
<BreadCrumb name="Settings" icon={faCogs} />

<div className="flex space-x-4">
<div>
<div className="w-40 py-5 mb-5 break-words border rounded-lg shadow-sm bg-gray-50">
<nav>
<NavItem to={`${url}/application`} description="Application" />
<NavItem to={`${url}/period`} description="Period Defaults" />
<NavItem to={`${url}/discord`} description="Discord Bot" />
</nav>
</div>
<div className="flex flex-col sm:space-x-4 sm:flex-row">
<div className="w-full py-5 mb-5 break-words border rounded-lg shadow-sm h-fit sm:w-40 bg-gray-50">
<nav>
<NavItem to={`${url}/application`} description="Application" />
<NavItem to={`${url}/period`} description="Period Defaults" />
<NavItem to={`${url}/discord`} description="Discord Bot" />
</nav>
</div>

<div className="w-full max-w-3xl praise-box">
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/Start/StartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PraiseTable from './components/PraiseTable';

const StartPage: React.FC = (): ReactElement => {
return (
<div className="max-w-2xl mx-auto">
<div className="praise-page">
<BreadCrumb name="Praise" icon={faPrayingHands} />

<ActiveNoticesBoard />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const UserDetailsPage = (): JSX.Element | null => {
</div>
<div className="praise-box">
<span className="text-xl font-bold">Roles</span>
<div className="flex gap-4 pt-5">
<div className="flex flex-wrap gap-4 pt-5">
{roles.map((role) => (
<div
key={role}
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/Users/UsersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import UsersTable from './components/UsersTable';

const UsersPage = (): JSX.Element => {
return (
<div className="max-w-2xl mx-auto">
<div className="praise-page">
<BreadCrumb name="Users" icon={faUserFriends} />
<UsersStatistics />
<div className="praise-box">
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/src/styles/custom-components.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.praise-page {
@apply max-w-5xl mx-auto
}

.praise-box {
@apply p-5 mb-5 break-words border rounded-lg shadow-sm bg-gray-50;
}
Expand Down

0 comments on commit aa69367

Please sign in to comment.