Skip to content

Commit

Permalink
Prettified Code!
Browse files Browse the repository at this point in the history
  • Loading branch information
mkue authored and actions-user committed Nov 11, 2023
1 parent f07fd05 commit cfba060
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 100 deletions.
22 changes: 12 additions & 10 deletions shared/src/firebase/client/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@ interface InitializeFirebaseClientProps {
functionsEmulatorPort?: number;
}

export const initializeFirebaseClient = ({
firebaseConfig,
authEmulatorUrl,
firestoreEmulatorHost,
firestoreEmulatorPort,
storageEmulatorHost,
storageEmulatorPort,
functionsEmulatorHost,
functionsEmulatorPort,
}: InitializeFirebaseClientProps) => {
export const initializeFirebaseClient = (
{
firebaseConfig,
authEmulatorUrl,
firestoreEmulatorHost,
firestoreEmulatorPort,
storageEmulatorHost,
storageEmulatorPort,
functionsEmulatorHost,
functionsEmulatorPort,
}: InitializeFirebaseClientProps,
) => {
const app = getOrInitializeFirebaseClientApp(firebaseConfig);
const auth = getAuth(app);
const functions = getFunctions(app, DEFAULT_REGION);
Expand Down
12 changes: 3 additions & 9 deletions shared/src/utils/messaging/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ interface SendEmailProps {
password: string;
}

export const sendEmail = async ({
from = '[email protected]',
to,
subject,
content,
attachments = [],
user,
password,
}: SendEmailProps) => {
export const sendEmail = async (
{ from = '[email protected]', to, subject, content, attachments = [], user, password }: SendEmailProps,
) => {
let transporter: Transporter;
if (!user) {
const testAccount = await nodemailer.createTestAccount();
Expand Down
9 changes: 3 additions & 6 deletions shared/src/utils/messaging/whatsapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ export interface SendWhatsappProps {
templateProps: RenderTemplateProps;
}

export const sendWhatsapp = async ({
to,
from,
twilioConfig,
templateProps,
}: SendWhatsappProps): Promise<MessageInstance> => {
export const sendWhatsapp = async (
{ to, from, twilioConfig, templateProps }: SendWhatsappProps,
): Promise<MessageInstance> => {
const client = new Twilio(twilioConfig.sid, twilioConfig.token);
const body = await renderTemplate(templateProps);
return client.messages.create({ body: body, from: `whatsapp:${from}`, to: `whatsapp:${to}` });
Expand Down
9 changes: 3 additions & 6 deletions shared/src/utils/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ const partials = [
];
partials.forEach((partial) => Handlebars.registerPartial(partial.name, readHbs(partial.path)));

export const renderTemplate = async ({
language,
translationNamespace = [],
hbsTemplatePath,
context,
}: RenderTemplateProps) => {
export const renderTemplate = async (
{ language, translationNamespace = [], hbsTemplatePath, context }: RenderTemplateProps,
) => {
const i18n = i18next.createInstance();
await i18n
.use(
Expand Down
8 changes: 3 additions & 5 deletions ui/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ UI elements:
**Example**:

```tsx
export const SoExampleComponent = ({
children,
exampleProperty,
...props
}: SoExampleComponentProps) => {
export const SoExampleComponent = (
{ children, exampleProperty, ...props }: SoExampleComponentProps,
) => {
return (
<p example-property={exampleProperty} {...props}>
{children}
Expand Down
11 changes: 3 additions & 8 deletions ui/src/components/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ type CarouselProps = {
showControls?: boolean;
} & React.HTMLAttributes<HTMLDivElement>;

export const Carousel = ({
children,
className,
options = {},
showDots = false,
showControls = false,
...props
}: CarouselProps) => {
export const Carousel = (
{ children, className, options = {}, showDots = false, showControls = false, ...props }: CarouselProps,
) => {
const [emblaRef, emblaApi] = useEmblaCarousel(
options,
options?.autoPlay?.enabled ? [Autoplay(options.autoPlay)] : [],
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFi
const FormField = <
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
>({
...props
}: ControllerProps<TFieldValues, TName>) => {
>(
{ ...props }: ControllerProps<TFieldValues, TName>,
) => {
return (
<FormFieldContext.Provider value={{ name: props.name }}>
<Controller {...props} />
Expand Down
22 changes: 12 additions & 10 deletions ui/src/components/typography/typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,18 @@ export type TypographyProps<C extends ElementType> = {
lineHeight?: LineHeight;
} & ComponentPropsWithoutRef<C>;

export function Typography<C extends ElementType = 'p'>({
as,
size = 'md',
weight = 'normal',
color = 'foreground',
lineHeight = 'normal',
className,
children,
...props
}: TypographyProps<C>) {
export function Typography<C extends ElementType = 'p'>(
{
as,
size = 'md',
weight = 'normal',
color = 'foreground',
lineHeight = 'normal',
className,
children,
...props
}: TypographyProps<C>,
) {
const Component = as || 'p';
return (
<Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ type ContributionStatsProps = {
currency: string;
};

export default function TransparencyCharts({
contributionStats,
paymentStats,
lang,
currency,
}: ContributionStatsProps) {
export default function TransparencyCharts(
{ contributionStats, paymentStats, lang, currency }: ContributionStatsProps,
) {
const translator = useTranslator(lang, 'website-transparency');

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@ type TransparencyCardProps = {
secondContent?: ReactElement;
};

export function InfoCard({
sectionTitle,
title,
text,
firstIcon,
firstContent,
secondIcon,
secondContent,
}: TransparencyCardProps) {
export function InfoCard(
{ sectionTitle, title, text, firstIcon, firstContent, secondIcon, secondContent }: TransparencyCardProps,
) {
return (
<div className="divide-neutral grid grid-cols-1 items-center divide-y rounded-lg bg-neutral-200 py-8 md:grid-cols-2 md:divide-x md:divide-y-0">
<div className="space-y-2 p-8">
Expand Down
10 changes: 3 additions & 7 deletions website/src/components/i18n-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ type I18nDialogProps = {
};
};

export function I18nDialog({
languages,
regions,
currencies,
translations,
children,
}: PropsWithChildren<I18nDialogProps>) {
export function I18nDialog(
{ languages, regions, currencies, translations, children }: PropsWithChildren<I18nDialogProps>,
) {
const [open, setOpen] = useState(false);
const { language, setLanguage, region, setRegion, currency, setCurrency } = useI18n();

Expand Down
12 changes: 3 additions & 9 deletions website/src/components/navbar/navbar-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,9 @@ type NavbarProps = {
}[];
} & DefaultParams;

export function NavbarClient({
lang,
region,
translations,
languages,
regions,
currencies,
sections = [],
}: NavbarProps) {
export function NavbarClient(
{ lang, region, translations, languages, regions, currencies, sections = [] }: NavbarProps,
) {
const [isOpen, setIsOpen] = useState(false);

const i18nDialog = (
Expand Down
15 changes: 3 additions & 12 deletions website/src/components/ui/book.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,9 @@ type BookProps = {
currentlyReading?: boolean;
};

export default async function Book({
cover,
author,
authorLink,
title,
description,
quote,
publisher,
publisherLink,
year,
currentlyReading,
}: BookProps) {
export default async function Book(
{ cover, author, authorLink, title, description, quote, publisher, publisherLink, year, currentlyReading }: BookProps,
) {
return (
<Card className="flex flex-col sm:flex-row">
<div className="w-fit basis-2/5 self-center">
Expand Down

0 comments on commit cfba060

Please sign in to comment.