mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 14:13:21 +00:00
notifications view sidebar
This commit is contained in:
parent
ab95376df4
commit
8c65913af7
29
src/js/components/header/Header.test.tsx
Normal file
29
src/js/components/header/Header.test.tsx
Normal file
@ -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();
|
||||||
|
});
|
||||||
|
});
|
@ -3,16 +3,15 @@ import { Cog8ToothIcon, HeartIcon } from '@heroicons/react/24/outline';
|
|||||||
import { ArrowLeftIcon, HeartIcon as HeartIconFull } from '@heroicons/react/24/solid';
|
import { ArrowLeftIcon, HeartIcon as HeartIconFull } from '@heroicons/react/24/solid';
|
||||||
import { Link, route } from 'preact-router';
|
import { Link, route } from 'preact-router';
|
||||||
|
|
||||||
import Component from '../BaseComponent';
|
import Component from '../../BaseComponent.ts';
|
||||||
import Key from '../nostr/Key';
|
import Key from '../../nostr/Key.ts';
|
||||||
import Relays from '../nostr/Relays';
|
import Relays from '../../nostr/Relays.ts';
|
||||||
import localState from '../state/LocalState.ts';
|
import localState from '../../state/LocalState.ts';
|
||||||
import { translate as t } from '../translations/Translation.mjs';
|
import { translate as t } from '../../translations/Translation.mjs';
|
||||||
import Icons from '../utils/Icons';
|
import Icons from '../../utils/Icons.tsx';
|
||||||
|
import Show from '../helpers/Show.tsx';
|
||||||
import Show from './helpers/Show';
|
import SearchBox from '../searchbox/SearchBox.tsx';
|
||||||
import SearchBox from './searchbox/SearchBox.tsx';
|
import Name from '../user/Name.tsx';
|
||||||
import Name from './user/Name';
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
@ -4,7 +4,7 @@ import Show from '@/components/helpers/Show';
|
|||||||
import { RouteProps } from '@/views/types';
|
import { RouteProps } from '@/views/types';
|
||||||
|
|
||||||
import Follow from '../components/buttons/Follow';
|
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 Avatar from '../components/user/Avatar';
|
||||||
import Name from '../components/user/Name';
|
import Name from '../components/user/Name';
|
||||||
import { translate as t } from '../translations/Translation.mjs';
|
import { translate as t } from '../translations/Translation.mjs';
|
||||||
|
@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|||||||
|
|
||||||
import { RouteProps } from '@/views/types.ts';
|
import { RouteProps } from '@/views/types.ts';
|
||||||
|
|
||||||
import Header from '../components/Header';
|
import Header from '../components/header/Header.tsx';
|
||||||
import Key from '../nostr/Key';
|
import Key from '../nostr/Key';
|
||||||
import { translate as t } from '../translations/Translation.mjs';
|
import { translate as t } from '../translations/Translation.mjs';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { RouteProps } from '@/views/types';
|
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';
|
import { translate as t } from '../translations/Translation.mjs';
|
||||||
|
|
||||||
const Subscribe: React.FC<RouteProps> = () => (
|
const Subscribe: React.FC<RouteProps> = () => (
|
||||||
|
@ -2,7 +2,7 @@ import debounce from 'lodash/debounce';
|
|||||||
import { useEffect, useRef } from 'preact/hooks';
|
import { useEffect, useRef } from 'preact/hooks';
|
||||||
|
|
||||||
import ErrorBoundary from '../components/ErrorBoundary';
|
import ErrorBoundary from '../components/ErrorBoundary';
|
||||||
import Header from '../components/Header';
|
import Header from '../components/header/Header.tsx';
|
||||||
import Show from '../components/helpers/Show';
|
import Show from '../components/helpers/Show';
|
||||||
|
|
||||||
import Search from './Search';
|
import Search from './Search';
|
||||||
|
@ -6,6 +6,7 @@ import EventDB from '@/nostr/EventDB';
|
|||||||
import Events from '@/nostr/Events';
|
import Events from '@/nostr/Events';
|
||||||
import Key from '@/nostr/Key';
|
import Key from '@/nostr/Key';
|
||||||
import { RouteProps } from '@/views/types.ts';
|
import { RouteProps } from '@/views/types.ts';
|
||||||
|
import View from '@/views/View.tsx';
|
||||||
|
|
||||||
import Feed from '../../components/feed/Feed';
|
import Feed from '../../components/feed/Feed';
|
||||||
import Session from '../../nostr/Session';
|
import Session from '../../nostr/Session';
|
||||||
@ -60,13 +61,15 @@ const Notifications: React.FC<RouteProps> = () => {
|
|||||||
}, [updateNotificationsLastOpened]);
|
}, [updateNotificationsLastOpened]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Feed
|
<View>
|
||||||
key="notifications"
|
<Feed
|
||||||
showDisplayAs={false}
|
key="notifications"
|
||||||
emptyMessage={t('no_notifications_yet')}
|
showDisplayAs={false}
|
||||||
filterOptions={filterOptions}
|
emptyMessage={t('no_notifications_yet')}
|
||||||
fetchEvents={fetchEvents}
|
filterOptions={filterOptions}
|
||||||
/>
|
fetchEvents={fetchEvents}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import Login from '@/views/login/Login.tsx';
|
|||||||
describe('Login View Rendering', () => {
|
describe('Login View Rendering', () => {
|
||||||
afterEach(cleanup);
|
afterEach(cleanup);
|
||||||
|
|
||||||
it('renders login form', () => {
|
it('renders login form', async () => {
|
||||||
render(<Login />);
|
render(<Login />);
|
||||||
|
|
||||||
const loginInput = screen.getByPlaceholderText(t('whats_your_name'));
|
const loginInput = screen.getByPlaceholderText(t('whats_your_name'));
|
||||||
|
@ -6,7 +6,7 @@ import { ID } from '@/utils/UniqueIds.ts';
|
|||||||
import { RouteProps } from '@/views/types.ts';
|
import { RouteProps } from '@/views/types.ts';
|
||||||
|
|
||||||
import Upload from '../../components/buttons/Upload.tsx';
|
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 SafeImg from '../../components/SafeImg.tsx';
|
||||||
import Key from '../../nostr/Key.ts';
|
import Key from '../../nostr/Key.ts';
|
||||||
import SocialNetwork from '../../nostr/SocialNetwork.ts';
|
import SocialNetwork from '../../nostr/SocialNetwork.ts';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Header from '../../components/Header';
|
import Header from '../../components/header/Header.tsx';
|
||||||
|
|
||||||
import SettingsContent from './SettingsContent';
|
import SettingsContent from './SettingsContent';
|
||||||
import SettingsMenu from './SettingsMenu';
|
import SettingsMenu from './SettingsMenu';
|
||||||
|
Loading…
Reference in New Issue
Block a user