Skip to content
Snippets Groups Projects
Unverified Commit 764a20a3 authored by Shazib Hussain's avatar Shazib Hussain Committed by GitHub
Browse files

Removing unused functions (#1145)

Continuing on from #1139 this PR deletes all function that are not used
anywhere.

The next PR will include all the entire files that are unused & deleted.
parent b8dbec46
No related branches found
No related tags found
No related merge requests found
......@@ -356,40 +356,6 @@ export function Search({
);
}
type KeyboardButtonProps = ComponentProps<typeof Button> & {
highlighted?: boolean;
};
export function KeyboardButton({
highlighted,
children,
...props
}: KeyboardButtonProps) {
return (
<Button
{...props}
bare
style={[
{
backgroundColor: 'white',
shadowColor: colors.n3,
shadowOffset: { width: 0, height: 1 },
shadowRadius: 1,
shadowOpacity: 1,
elevation: 4,
borderWidth: 0,
paddingLeft: 17,
paddingRight: 17,
},
highlighted && { backgroundColor: colors.p6 },
props.style,
]}
textStyle={[highlighted && { color: 'white' }]}
>
{children}
</Button>
);
}
type SelectProps = HTMLPropsWithStyle<HTMLSelectElement>;
export const Select = forwardRef<HTMLSelectElement, SelectProps>(
......@@ -696,16 +662,6 @@ export function P({ style, isLast, children, ...props }: PProps) {
);
}
type StrongProps = HTMLPropsWithStyle<HTMLSpanElement>;
export function Strong({ style, children, ...props }: StrongProps) {
return (
<span {...props} {...css(style, { fontWeight: 500 })}>
{children}
</span>
);
}
type InlineFieldProps = {
label: ReactNode;
labelWidth?: number;
......@@ -859,7 +815,5 @@ export function Label({ title, style }: LabelProps) {
);
}
export const NullComponent = () => null;
export * from './tooltips';
export { useTooltip } from './tooltips';
......@@ -3,16 +3,13 @@ import React, {
forwardRef,
useEffect,
useState,
type ReactNode,
} from 'react';
import { useHistory, useLocation } from 'react-router-dom';
import { type CSSProperties } from 'glamor';
import { send } from 'loot-core/src/platform/client/fetch';
import { colors, styles } from '../../../style';
import { Text, Button, Input as BaseInput } from '../../common';
import { Input as BaseInput } from '../../common';
import { useSetServerURL } from '../../ServerContext';
// There are two URLs that dance with each other: `/login` and
......@@ -78,14 +75,6 @@ export function useBootstrapped() {
return { checked };
}
export function getEmail(location) {
let m = location.search.match(/email=([^&]*)/);
if (!m) {
return '';
}
return decodeURIComponent(m[1]);
}
type TitleProps = {
text: string;
};
......@@ -122,93 +111,3 @@ export const Input = forwardRef<HTMLInputElement, InputProps>((props, ref) => {
/>
);
});
type BareButtonProps = ComponentProps<typeof Button>;
export const BareButton = forwardRef<HTMLButtonElement, BareButtonProps>(
(props, ref) => {
return (
<Button
ref={ref}
bare
{...props}
style={[
{
color: colors.p4,
fontSize: 15,
textDecoration: 'none',
padding: '5px 7px',
borderRadius: 4,
':hover': {
backgroundColor: colors.n9,
},
':active': {
backgroundColor: colors.n9,
},
},
props.style,
]}
/>
);
},
);
type ExternalLinkProps = ComponentProps<typeof BareButton>;
export const ExternalLink = forwardRef<HTMLButtonElement, ExternalLinkProps>(
(props, ref) => {
let { href, ...linkProps } = props;
return (
<BareButton
// @ts-expect-error prop does not exist on Button
to="/"
{...linkProps}
onClick={e => {
e.preventDefault();
window.Actual.openURLInBrowser(href);
}}
/>
);
},
);
type BackLinkProps = ComponentProps<typeof BareButton> & {
history;
};
export const BackLink = forwardRef<HTMLButtonElement, BackLinkProps>(
(props, ref) => {
return (
<BareButton
ref={ref}
// @ts-expect-error prop does not exist on Button
to="/"
onClick={e => {
e.preventDefault();
props.history.goBack();
}}
>
Back
</BareButton>
);
},
);
type ParagraphProps = {
style?: CSSProperties;
children: ReactNode;
};
export function Paragraph({ style, children }: ParagraphProps) {
return (
<Text
style={[
{
fontSize: 15,
color: colors.n2,
lineHeight: 1.5,
marginTop: 20,
},
style,
]}
>
{children}
</Text>
);
}
......@@ -8,10 +8,6 @@ export function fromDateReprToDay(date) {
return date;
}
export function toDateRepr(str) {
return parseInt(str.replace(/-/g, ''), 10);
}
export async function runAll(queries, cb) {
let data = await Promise.all(
queries.map(q => {
......
......@@ -66,12 +66,6 @@ export function getStatusProps(status) {
return { color, backgroundColor, Icon };
}
export function StatusIcon({ status }) {
let { color, Icon } = getStatusProps(status);
return <Icon style={{ width: 13, height: 13, color }} />;
}
export function StatusBadge({ status, style }) {
let { color, backgroundColor, Icon } = getStatusProps(status);
return (
......
import { useEffect, useRef } from 'react';
import { useEffect } from 'react';
import { setThemeColor } from '../util/withThemeColor';
export function useScrollFlasher() {
let scrollRef = useRef(null);
useEffect(() => {
setTimeout(() => {
if (scrollRef.current) {
scrollRef.current.flashScrollIndicators();
}
}, 1000);
}, []);
return scrollRef;
}
export function useSetThemeColor(color) {
useEffect(() => {
setThemeColor(color);
......
......@@ -2,8 +2,6 @@ import * as Platform from 'loot-core/src/client/platform';
import tokens from './tokens';
export const debug = { borderWidth: 1, borderColor: 'red' };
export const colors = {
y1: '#733309',
y2: '#87540d',
......
---
category: Maintenance
authors: [Shazib]
---
Remove unused functions from source
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment