Remove unused code
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
0308aec65b
commit
b9e5358cd7
20 changed files with 2 additions and 553 deletions
|
@ -2,11 +2,11 @@
|
|||
{
|
||||
"id": "1",
|
||||
"text": "Illegal activity and behavior",
|
||||
"subtext": "Content that depicts illegal or criminal acts, threats of violence.",
|
||||
"subtext": "Content that depicts illegal or criminal acts, threats of violence."
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"text": "Intellectual property infringement",
|
||||
"subtext": "Impersonating another account or business, infringing on intellectual property rights.",
|
||||
"subtext": "Impersonating another account or business, infringing on intellectual property rights."
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
import { Entities } from 'soapbox/entity-store/entities';
|
||||
import { useCreateEntity } from 'soapbox/entity-store/hooks';
|
||||
import { useApi } from 'soapbox/hooks';
|
||||
import { domainSchema } from 'soapbox/schemas';
|
||||
|
||||
interface CreateDomainParams {
|
||||
domain: string;
|
||||
public: boolean;
|
||||
}
|
||||
|
||||
const useCreateDomain = () => {
|
||||
const api = useApi();
|
||||
|
||||
const { createEntity, ...rest } = useCreateEntity([Entities.DOMAINS], (params: CreateDomainParams) =>
|
||||
api.post('/api/v1/pleroma/admin/domains', params), { schema: domainSchema });
|
||||
|
||||
return {
|
||||
createDomain: createEntity,
|
||||
...rest,
|
||||
};
|
||||
};
|
||||
|
||||
export { useCreateDomain, type CreateDomainParams };
|
|
@ -1,21 +0,0 @@
|
|||
import { Entities } from 'soapbox/entity-store/entities';
|
||||
import { useDeleteEntity } from 'soapbox/entity-store/hooks';
|
||||
import { useApi } from 'soapbox/hooks';
|
||||
|
||||
const useDeleteDomain = () => {
|
||||
const api = useApi();
|
||||
|
||||
const { deleteEntity, ...rest } = useDeleteEntity(Entities.DOMAINS, (id: string) =>
|
||||
api.delete(`/api/v1/pleroma/admin/domains/${id}`, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
}));
|
||||
|
||||
return {
|
||||
mutate: deleteEntity,
|
||||
...rest,
|
||||
};
|
||||
};
|
||||
|
||||
export { useDeleteDomain };
|
|
@ -1,20 +0,0 @@
|
|||
import { Entities } from 'soapbox/entity-store/entities';
|
||||
import { useCreateEntity } from 'soapbox/entity-store/hooks';
|
||||
import { useApi } from 'soapbox/hooks';
|
||||
import { domainSchema } from 'soapbox/schemas';
|
||||
|
||||
import type { CreateDomainParams } from './useCreateDomain';
|
||||
|
||||
const useUpdateDomain = (id: string) => {
|
||||
const api = useApi();
|
||||
|
||||
const { createEntity, ...rest } = useCreateEntity([Entities.DOMAINS], (params: Omit<CreateDomainParams, 'domain'>) =>
|
||||
api.patch(`/api/v1/pleroma/admin/domains/${id}`, params), { schema: domainSchema });
|
||||
|
||||
return {
|
||||
updateDomain: createEntity,
|
||||
...rest,
|
||||
};
|
||||
};
|
||||
|
||||
export { useUpdateDomain };
|
|
@ -1,15 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
import { buildAccount } from 'soapbox/jest/factory';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import DisplayName from './display-name';
|
||||
|
||||
describe('<DisplayName />', () => {
|
||||
it('renders display name + account name', () => {
|
||||
const account = buildAccount({ acct: 'bar@baz' });
|
||||
render(<DisplayName account={account} />);
|
||||
|
||||
expect(screen.getByTestId('display-name')).toHaveTextContent('bar@baz');
|
||||
});
|
||||
});
|
|
@ -1,49 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
import HoverRefWrapper from 'soapbox/components/hover-ref-wrapper';
|
||||
import { useSoapboxConfig } from 'soapbox/hooks';
|
||||
|
||||
import { getAcct } from '../utils/accounts';
|
||||
|
||||
import { HStack, Text } from './ui';
|
||||
import VerificationBadge from './verification-badge';
|
||||
|
||||
import type { Account } from 'soapbox/schemas';
|
||||
|
||||
interface IDisplayName {
|
||||
account: Pick<Account, 'id' | 'acct' | 'fqn' | 'verified' | 'display_name_html'>;
|
||||
withSuffix?: boolean;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
const DisplayName: React.FC<IDisplayName> = ({ account, children, withSuffix = true }) => {
|
||||
const { displayFqn = false } = useSoapboxConfig();
|
||||
const { verified } = account;
|
||||
|
||||
const displayName = (
|
||||
<HStack space={1} alignItems='center' grow>
|
||||
<Text
|
||||
size='sm'
|
||||
weight='semibold'
|
||||
truncate
|
||||
dangerouslySetInnerHTML={{ __html: account.display_name_html }}
|
||||
/>
|
||||
|
||||
{verified && <VerificationBadge />}
|
||||
</HStack>
|
||||
);
|
||||
|
||||
const suffix = (<span className='display-name__account'>@{getAcct(account, displayFqn)}</span>);
|
||||
|
||||
return (
|
||||
<span className='display-name' data-testid='display-name'>
|
||||
<HoverRefWrapper accountId={account.id} inline>
|
||||
{displayName}
|
||||
</HoverRefWrapper>
|
||||
{withSuffix && suffix}
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export default DisplayName;
|
|
@ -1,23 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
import PullToRefresh from './pull-to-refresh';
|
||||
|
||||
interface IPullable {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pullable:
|
||||
* Basic "pull to refresh" without the refresh.
|
||||
* Just visual feedback.
|
||||
*/
|
||||
const Pullable: React.FC<IPullable> = ({ children }) =>(
|
||||
<PullToRefresh
|
||||
// @ts-ignore
|
||||
refreshingContent={null}
|
||||
>
|
||||
{children}
|
||||
</PullToRefresh>
|
||||
);
|
||||
|
||||
export default Pullable;
|
|
@ -1,30 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import ValidationCheckmark from './validation-checkmark';
|
||||
|
||||
describe('<ValidationCheckmark />', () => {
|
||||
it('renders text', () => {
|
||||
const text = 'some validation';
|
||||
render(<ValidationCheckmark text={text} isValid />);
|
||||
|
||||
expect(screen.getByTestId('validation-checkmark')).toHaveTextContent(text);
|
||||
});
|
||||
|
||||
it('uses a green check when valid', () => {
|
||||
const text = 'some validation';
|
||||
render(<ValidationCheckmark text={text} isValid />);
|
||||
|
||||
expect(screen.getByTestId('svg-icon-loader')).toHaveClass('text-success-500');
|
||||
expect(screen.getByTestId('svg-icon-loader')).not.toHaveClass('text-gray-400');
|
||||
});
|
||||
|
||||
it('uses a gray check when valid', () => {
|
||||
const text = 'some validation';
|
||||
render(<ValidationCheckmark text={text} isValid={false} />);
|
||||
|
||||
expect(screen.getByTestId('svg-icon-loader')).toHaveClass('text-gray-400');
|
||||
expect(screen.getByTestId('svg-icon-loader')).not.toHaveClass('text-success-500');
|
||||
});
|
||||
});
|
|
@ -1,28 +0,0 @@
|
|||
import clsx from 'clsx';
|
||||
import React from 'react';
|
||||
|
||||
import { HStack, Icon, Text } from 'soapbox/components/ui';
|
||||
|
||||
interface IValidationCheckmark {
|
||||
isValid: boolean;
|
||||
text: string;
|
||||
}
|
||||
|
||||
const ValidationCheckmark = ({ isValid, text }: IValidationCheckmark) => {
|
||||
return (
|
||||
<HStack alignItems='center' space={2} data-testid='validation-checkmark'>
|
||||
<Icon
|
||||
src={isValid ? require('@tabler/icons/outline/check.svg') : require('@tabler/icons/outline/point.svg')}
|
||||
className={clsx({
|
||||
'w-4 h-4': true,
|
||||
'text-gray-400 dark:text-gray-600 dark:fill-gray-600 fill-gray-400': !isValid,
|
||||
'text-success-500': isValid,
|
||||
})}
|
||||
/>
|
||||
|
||||
<Text theme='muted' size='sm'>{text}</Text>
|
||||
</HStack>
|
||||
);
|
||||
};
|
||||
|
||||
export default ValidationCheckmark;
|
|
@ -1,21 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
import { buildGroup } from 'soapbox/jest/factory';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import GroupGridItem from './group-grid-item';
|
||||
|
||||
describe('<GroupGridItem', () => {
|
||||
it('should render correctly', () => {
|
||||
const group = buildGroup({
|
||||
display_name: 'group name here',
|
||||
locked: false,
|
||||
members_count: 6,
|
||||
});
|
||||
render(<GroupGridItem group={group} />);
|
||||
|
||||
expect(screen.getByTestId('group-grid-item')).toHaveTextContent(group.display_name);
|
||||
expect(screen.getByTestId('group-grid-item')).toHaveTextContent('Public');
|
||||
expect(screen.getByTestId('group-grid-item')).toHaveTextContent('6 members');
|
||||
});
|
||||
});
|
|
@ -1,74 +0,0 @@
|
|||
import React, { forwardRef } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import GroupAvatar from 'soapbox/components/groups/group-avatar';
|
||||
import { HStack, Stack, Text } from 'soapbox/components/ui';
|
||||
import GroupActionButton from 'soapbox/features/group/components/group-action-button';
|
||||
import GroupHeaderImage from 'soapbox/features/group/components/group-header-image';
|
||||
import GroupMemberCount from 'soapbox/features/group/components/group-member-count';
|
||||
import GroupPrivacy from 'soapbox/features/group/components/group-privacy';
|
||||
|
||||
import type { Group } from 'soapbox/schemas';
|
||||
|
||||
interface IGroup {
|
||||
group: Group;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
const GroupGridItem = forwardRef((props: IGroup, ref: React.ForwardedRef<HTMLDivElement>) => {
|
||||
const { group, width = 'auto' } = props;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={group.id}
|
||||
className='relative flex shrink-0 flex-col space-y-2 px-1'
|
||||
style={{
|
||||
width,
|
||||
}}
|
||||
data-testid='group-grid-item'
|
||||
>
|
||||
<Link to={`/group/${group.id}`}>
|
||||
<Stack
|
||||
className='aspect-h-7 aspect-w-10 h-full w-full overflow-hidden rounded-lg'
|
||||
ref={ref}
|
||||
style={{ minHeight: 180 }}
|
||||
>
|
||||
<GroupHeaderImage
|
||||
group={group}
|
||||
className='absolute inset-0 object-cover'
|
||||
/>
|
||||
|
||||
<div
|
||||
className='absolute inset-x-0 bottom-0 flex justify-center rounded-b-lg bg-gradient-to-t from-gray-900 to-transparent pb-8 pt-12 transition-opacity duration-500'
|
||||
/>
|
||||
|
||||
<Stack justifyContent='end' className='p-4 text-white' space={3}>
|
||||
<GroupAvatar
|
||||
group={group}
|
||||
size={44}
|
||||
/>
|
||||
|
||||
<Stack space={1}>
|
||||
<Text
|
||||
weight='bold'
|
||||
dangerouslySetInnerHTML={{ __html: group.display_name_html }}
|
||||
theme='inherit'
|
||||
truncate
|
||||
/>
|
||||
|
||||
<HStack alignItems='center' space={1}>
|
||||
<GroupPrivacy group={group} />
|
||||
<span>•</span>
|
||||
<GroupMemberCount group={group} />
|
||||
</HStack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Link>
|
||||
|
||||
<GroupActionButton group={group} />
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default GroupGridItem;
|
|
@ -1,38 +0,0 @@
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
import { render, screen, within } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import LayoutButtons, { GroupLayout } from './layout-buttons';
|
||||
|
||||
describe('<LayoutButtons', () => {
|
||||
describe('when LIST view', () => {
|
||||
it('should render correctly', async () => {
|
||||
const onSelectFn = vi.fn();
|
||||
const user = userEvent.setup();
|
||||
|
||||
render(<LayoutButtons layout={GroupLayout.LIST} onSelect={onSelectFn} />);
|
||||
|
||||
expect(within(screen.getByTestId('layout-list-action')).getByTestId('svg-icon-loader')).toHaveClass('text-primary-600');
|
||||
expect(within(screen.getByTestId('layout-grid-action')).getByTestId('svg-icon-loader')).not.toHaveClass('text-primary-600');
|
||||
|
||||
await user.click(screen.getByTestId('layout-grid-action'));
|
||||
expect(onSelectFn).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when GRID view', () => {
|
||||
it('should render correctly', async () => {
|
||||
const onSelectFn = vi.fn();
|
||||
const user = userEvent.setup();
|
||||
|
||||
render(<LayoutButtons layout={GroupLayout.GRID} onSelect={onSelectFn} />);
|
||||
|
||||
expect(within(screen.getByTestId('layout-list-action')).getByTestId('svg-icon-loader')).not.toHaveClass('text-primary-600');
|
||||
expect(within(screen.getByTestId('layout-grid-action')).getByTestId('svg-icon-loader')).toHaveClass('text-primary-600');
|
||||
|
||||
await user.click(screen.getByTestId('layout-grid-action'));
|
||||
expect(onSelectFn).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,48 +0,0 @@
|
|||
import clsx from 'clsx';
|
||||
import React from 'react';
|
||||
|
||||
import { HStack, Icon } from 'soapbox/components/ui';
|
||||
|
||||
enum GroupLayout {
|
||||
LIST = 'LIST',
|
||||
GRID = 'GRID'
|
||||
}
|
||||
|
||||
interface ILayoutButtons {
|
||||
layout: GroupLayout;
|
||||
onSelect(layout: GroupLayout): void;
|
||||
}
|
||||
|
||||
const LayoutButtons = ({ layout, onSelect }: ILayoutButtons) => (
|
||||
<HStack alignItems='center' space={1}>
|
||||
<button
|
||||
data-testid='layout-list-action'
|
||||
onClick={() => onSelect(GroupLayout.LIST)}
|
||||
>
|
||||
<Icon
|
||||
src={require('@tabler/icons/outline/layout-list.svg')}
|
||||
className={
|
||||
clsx('h-5 w-5 text-gray-600', {
|
||||
'text-primary-600': layout === GroupLayout.LIST,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</button>
|
||||
|
||||
<button
|
||||
data-testid='layout-grid-action'
|
||||
onClick={() => onSelect(GroupLayout.GRID)}
|
||||
>
|
||||
<Icon
|
||||
src={require('@tabler/icons/outline/layout-grid.svg')}
|
||||
className={
|
||||
clsx('h-5 w-5 text-gray-600', {
|
||||
'text-primary-600': layout === GroupLayout.GRID,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</button>
|
||||
</HStack>
|
||||
);
|
||||
|
||||
export { LayoutButtons as default, GroupLayout };
|
|
@ -1,41 +0,0 @@
|
|||
import React, { useMemo } from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
import { Tabs } from 'soapbox/components/ui';
|
||||
|
||||
import type { Item } from 'soapbox/components/ui/tabs/tabs';
|
||||
|
||||
export enum TabItems {
|
||||
MY_GROUPS = 'MY_GROUPS',
|
||||
FIND_GROUPS = 'FIND_GROUPS'
|
||||
}
|
||||
|
||||
interface ITabBar {
|
||||
activeTab: TabItems;
|
||||
}
|
||||
|
||||
const TabBar = ({ activeTab }: ITabBar) => {
|
||||
const history = useHistory();
|
||||
|
||||
const tabItems: Item[] = useMemo(() => ([
|
||||
{
|
||||
text: 'My Groups',
|
||||
action: () => history.push('/groups'),
|
||||
name: TabItems.MY_GROUPS,
|
||||
},
|
||||
{
|
||||
text: 'Find Groups',
|
||||
action: () => history.push('/groups/discover'),
|
||||
name: TabItems.FIND_GROUPS,
|
||||
},
|
||||
]), []);
|
||||
|
||||
return (
|
||||
<Tabs
|
||||
items={tabItems}
|
||||
activeItem={activeTab}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default TabBar;
|
|
@ -1,28 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
import GroupAvatar from 'soapbox/components/groups/group-avatar';
|
||||
import { HStack, Text } from 'soapbox/components/ui';
|
||||
import { type Group } from 'soapbox/schemas';
|
||||
|
||||
interface IGroupListItem {
|
||||
group: Group;
|
||||
onUnmute(): void;
|
||||
}
|
||||
|
||||
const GroupListItem = ({ group, onUnmute }: IGroupListItem) => (
|
||||
<HStack alignItems='center' space={3}>
|
||||
<GroupAvatar
|
||||
group={group}
|
||||
size={42}
|
||||
/>
|
||||
|
||||
<Text
|
||||
weight='semibold'
|
||||
size='sm'
|
||||
dangerouslySetInnerHTML={{ __html: group.display_name_html }}
|
||||
truncate
|
||||
/>
|
||||
</HStack>
|
||||
);
|
||||
|
||||
export default GroupListItem;
|
|
@ -1,38 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
import { HStack, Stack, Text } from 'soapbox/components/ui';
|
||||
|
||||
import { generateText, randomIntFromInterval } from '../utils';
|
||||
|
||||
const PlaceholderGroupDiscover = () => {
|
||||
const groupNameLength = randomIntFromInterval(12, 20);
|
||||
|
||||
return (
|
||||
<Stack space={2} className='animate-pulse'>
|
||||
<Stack className='aspect-h-7 aspect-w-10 h-full w-full overflow-hidden rounded-lg'>
|
||||
{/* Group Cover Image */}
|
||||
<div className='absolute inset-0 rounded-t-lg bg-gray-300 object-cover dark:bg-gray-800' />
|
||||
|
||||
<Stack justifyContent='end' className='z-10 p-4 text-gray-900 dark:text-gray-100' space={3}>
|
||||
{/* Group Avatar */}
|
||||
<div className='h-11 w-11 rounded-full bg-gray-500 dark:bg-gray-700 dark:ring-primary-900' />
|
||||
|
||||
{/* Group Info */}
|
||||
<Stack space={1} className='text-gray-500 dark:text-gray-700'>
|
||||
<Text theme='inherit' weight='bold' truncate>{generateText(groupNameLength)}</Text>
|
||||
|
||||
<HStack space={3} wrap>
|
||||
<Text tag='span' theme='inherit'>{generateText(6)}</Text>
|
||||
<Text tag='span' theme='inherit'>{generateText(6)}</Text>
|
||||
</HStack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
{/* Join Group Button */}
|
||||
<div className='h-10 w-full rounded-full bg-gray-300 dark:bg-gray-800' />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
export default PlaceholderGroupDiscover;
|
|
@ -1,16 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
import PlaceholderStatus from './placeholder-status';
|
||||
|
||||
/** Fake material status to display while data is loading. */
|
||||
const PlaceholderMaterialStatus: React.FC = () => {
|
||||
return (
|
||||
<div className='material-status' tabIndex={-1} aria-hidden>
|
||||
<div className='material-status__status' tabIndex={0}>
|
||||
<PlaceholderStatus />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default PlaceholderMaterialStatus;
|
|
@ -18,7 +18,6 @@
|
|||
@import 'components/detailed-status';
|
||||
@import 'components/media-gallery';
|
||||
@import 'components/notification';
|
||||
@import 'components/display-name';
|
||||
@import 'components/columns';
|
||||
@import 'components/search';
|
||||
@import 'components/video-player';
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
.display-name {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
position: relative;
|
||||
|
||||
bdi {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__account {
|
||||
position: relative;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
/** List of supported E164 country codes. */
|
||||
const COUNTRY_CODES = [
|
||||
'1',
|
||||
'351',
|
||||
'44',
|
||||
'55',
|
||||
] as const;
|
||||
|
||||
/** Supported E164 country code. */
|
||||
type CountryCode = typeof COUNTRY_CODES[number];
|
||||
|
||||
/** Check whether a given value is a country code. */
|
||||
const isCountryCode = (value: any): value is CountryCode => COUNTRY_CODES.includes(value);
|
||||
|
||||
export {
|
||||
COUNTRY_CODES,
|
||||
CountryCode,
|
||||
isCountryCode,
|
||||
};
|
Loading…
Reference in a new issue