Skip to content

Commit

Permalink
notifications view sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalmi committed Aug 21, 2023
1 parent ab95376 commit 8c65913
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 24 deletions.
29 changes: 29 additions & 0 deletions src/js/components/header/Header.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { cleanup, render, screen } from '@testing-library/preact';
import { afterEach, describe, expect, it } from 'vitest';

import localState from '@/state/LocalState.ts';
import { translate as t } from '@/translations/Translation.mjs';

import Header from './Header.tsx';

describe('Header Component Rendering', () => {
afterEach(cleanup);

it('renders iris logo for homepage', () => {
localState.get('activeRoute').put('/');
render(<Header />);

const logo = screen.getByText('iris');
expect(logo).not.toBeNull();
});

it('renders login and signup buttons when not logged in', () => {
render(<Header />);

const loginBtn = screen.getByText(t('log_in'));
expect(loginBtn).not.toBeNull();

const signupBtn = screen.getByText(t('sign_up'));
expect(signupBtn).not.toBeNull();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import { Cog8ToothIcon, HeartIcon } from '@heroicons/react/24/outline';
import { ArrowLeftIcon, HeartIcon as HeartIconFull } from '@heroicons/react/24/solid';
import { Link, route } from 'preact-router';

import Component from '../BaseComponent';
import Key from '../nostr/Key';
import Relays from '../nostr/Relays';
import localState from '../state/LocalState.ts';
import { translate as t } from '../translations/Translation.mjs';
import Icons from '../utils/Icons';

import Show from './helpers/Show';
import SearchBox from './searchbox/SearchBox.tsx';
import Name from './user/Name';
import Component from '../../BaseComponent.ts';
import Key from '../../nostr/Key.ts';
import Relays from '../../nostr/Relays.ts';
import localState from '../../state/LocalState.ts';
import { translate as t } from '../../translations/Translation.mjs';
import Icons from '../../utils/Icons.tsx';
import Show from '../helpers/Show.tsx';
import SearchBox from '../searchbox/SearchBox.tsx';
import Name from '../user/Name.tsx';

declare global {
interface Window {
Expand Down
2 changes: 1 addition & 1 deletion src/js/views/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Show from '@/components/helpers/Show';
import { RouteProps } from '@/views/types';

import Follow from '../components/buttons/Follow';
import Header from '../components/Header';
import Header from '../components/header/Header.tsx';
import Avatar from '../components/user/Avatar';
import Name from '../components/user/Name';
import { translate as t } from '../translations/Translation.mjs';
Expand Down
2 changes: 1 addition & 1 deletion src/js/views/KeyConverter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from 'react';

import { RouteProps } from '@/views/types.ts';

import Header from '../components/Header';
import Header from '../components/header/Header.tsx';
import Key from '../nostr/Key';
import { translate as t } from '../translations/Translation.mjs';

Expand Down
2 changes: 1 addition & 1 deletion src/js/views/Subscribe.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RouteProps } from '@/views/types';

import Header from '../components/Header';
import Header from '../components/header/Header.tsx';
import { translate as t } from '../translations/Translation.mjs';

const Subscribe: React.FC<RouteProps> = () => (
Expand Down
2 changes: 1 addition & 1 deletion src/js/views/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import debounce from 'lodash/debounce';
import { useEffect, useRef } from 'preact/hooks';

import ErrorBoundary from '../components/ErrorBoundary';
import Header from '../components/Header';
import Header from '../components/header/Header.tsx';
import Show from '../components/helpers/Show';

import Search from './Search';
Expand Down
17 changes: 10 additions & 7 deletions src/js/views/feeds/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import EventDB from '@/nostr/EventDB';
import Events from '@/nostr/Events';
import Key from '@/nostr/Key';
import { RouteProps } from '@/views/types.ts';
import View from '@/views/View.tsx';

import Feed from '../../components/feed/Feed';
import Session from '../../nostr/Session';
Expand Down Expand Up @@ -60,13 +61,15 @@ const Notifications: React.FC<RouteProps> = () => {
}, [updateNotificationsLastOpened]);

return (
<Feed
key="notifications"
showDisplayAs={false}
emptyMessage={t('no_notifications_yet')}
filterOptions={filterOptions}
fetchEvents={fetchEvents}
/>
<View>
<Feed
key="notifications"
showDisplayAs={false}
emptyMessage={t('no_notifications_yet')}
filterOptions={filterOptions}
fetchEvents={fetchEvents}
/>
</View>
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/js/views/login/Login.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Login from '@/views/login/Login.tsx';
describe('Login View Rendering', () => {
afterEach(cleanup);

it('renders login form', () => {
it('renders login form', async () => {
render(<Login />);

const loginInput = screen.getByPlaceholderText(t('whats_your_name'));
Expand Down
2 changes: 1 addition & 1 deletion src/js/views/profile/EditProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ID } from '@/utils/UniqueIds.ts';
import { RouteProps } from '@/views/types.ts';

import Upload from '../../components/buttons/Upload.tsx';
import Header from '../../components/Header.tsx';
import Header from '../../components/header/Header.tsx';
import SafeImg from '../../components/SafeImg.tsx';
import Key from '../../nostr/Key.ts';
import SocialNetwork from '../../nostr/SocialNetwork.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/js/views/settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Header from '../../components/Header';
import Header from '../../components/header/Header.tsx';

import SettingsContent from './SettingsContent';
import SettingsMenu from './SettingsMenu';
Expand Down

0 comments on commit 8c65913

Please sign in to comment.