Skip to content

A local-first personal finance app

Removing unused functions (#1145)

Shazib Hussain764a20a36bbb
diff --git a/packages/desktop-client/src/components/common.tsx b/packages/desktop-client/src/components/common.tsx
index 9df6cd3472..1839948828 100644
--- a/packages/desktop-client/src/components/common.tsx
+++ b/packages/desktop-client/src/components/common.tsx
@@ -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';
diff --git a/packages/desktop-client/src/components/manager/subscribe/common.tsx b/packages/desktop-client/src/components/manager/subscribe/common.tsx
index 9e0082fb7a..73b2c58b03 100644
--- a/packages/desktop-client/src/components/manager/subscribe/common.tsx
+++ b/packages/desktop-client/src/components/manager/subscribe/common.tsx
@@ -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>
- );
-}
diff --git a/packages/desktop-client/src/components/reports/util.js b/packages/desktop-client/src/components/reports/util.js
index 9866fca32b..9cd905366d 100644
--- a/packages/desktop-client/src/components/reports/util.js
+++ b/packages/desktop-client/src/components/reports/util.js
@@ -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 => {
diff --git a/packages/desktop-client/src/components/schedules/StatusBadge.js b/packages/desktop-client/src/components/schedules/StatusBadge.js
index ca8fbea125..99ebf9f7ec 100644
--- a/packages/desktop-client/src/components/schedules/StatusBadge.js
+++ b/packages/desktop-client/src/components/schedules/StatusBadge.js
@@ -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 (
diff --git a/packages/desktop-client/src/hooks/index.js b/packages/desktop-client/src/hooks/index.js
index 85bd3a7dce..8304c4bbf4 100644
--- a/packages/desktop-client/src/hooks/index.js
+++ b/packages/desktop-client/src/hooks/index.js
@@ -1,21 +1,7 @@
-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);
diff --git a/packages/desktop-client/src/style.tsx b/packages/desktop-client/src/style.tsx
index 84fa957e75..13dbcc255f 100644
--- a/packages/desktop-client/src/style.tsx
+++ b/packages/desktop-client/src/style.tsx
@@ -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',
diff --git a/upcoming-release-notes/1145.md b/upcoming-release-notes/1145.md
new file mode 100644
index 0000000000..252ad367a0
--- /dev/null
+++ b/upcoming-release-notes/1145.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [Shazib]
+---
+
+Remove unused functions from source