Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/src/app/(root)/(main)/(home)/page.view.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { PageViewInput } from "../../../types";
import type { Schemas } from "./schemas";

import { TestWidget } from "../../../../client/test/components/test/test-widget";
import { TestWidget } from "../../../../client/test/components/test-widget";
import { LoadingWidget } from "../../../../common/core/components/generic/loading-widget";
import { Hydrated } from "../../../../isomorphic/generic/components/hydrated";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Button, TextInput } from "@mantine/core";

import type { TestFormInput } from "./types";

import { useForm } from "../../../../../../../isomorphic/core/hooks/use-form";
import { useLocalization } from "../../../../../../../isomorphic/localization/hooks/use-localization";
import { useForm } from "../../../../../../isomorphic/core/hooks/use-form";
import { useLocalization } from "../../../../../../isomorphic/localization/hooks/use-localization";
import { Schemas } from "./schemas";

export function TestForm({ initialValues, onError, onSubmit }: TestFormInput) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
UseFormOnSubmit,
UseFormSubmitInput,
UseFormValues,
} from "../../../../../../../isomorphic/core/hooks/use-form";
} from "../../../../../../isomorphic/core/hooks/use-form";
import type { Schemas } from "./schemas";

export type TestFormSchema = typeof Schemas.Values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { useCallback, useState } from "react";
import type { TestFormSubmitInput } from "./components/test-form";
import type { TestWidgetInput } from "./types";

import { dayjs } from "../../../../../common/dates/vars/dayjs";
import { getValidationIssue } from "../../../../../common/orpc/lib/get-validation-issue";
import { isOrpcDefinedError } from "../../../../../common/orpc/lib/is-orpc-defined-error";
import { useLocalization } from "../../../../../isomorphic/localization/hooks/use-localization";
import { useNotifications } from "../../../../../isomorphic/notifications/hooks/use-notifications";
import { useNow } from "../../../../generic/hooks/use-now";
import { orpcClientSideQueryClient } from "../../../../orpc/vars/clients";
import { dayjs } from "../../../../common/dates/vars/dayjs";
import { getValidationIssue } from "../../../../common/orpc/lib/get-validation-issue";
import { isOrpcDefinedError } from "../../../../common/orpc/lib/is-orpc-defined-error";
import { useLocalization } from "../../../../isomorphic/localization/hooks/use-localization";
import { useNotifications } from "../../../../isomorphic/notifications/hooks/use-notifications";
import { useNow } from "../../../generic/hooks/use-now";
import { orpcClientSideQueryClient } from "../../../orpc/vars/clients";
import { TestForm } from "./components/test-form";

export function TestWidget({}: TestWidgetInput) {
Expand Down
18 changes: 15 additions & 3 deletions src/src/common/generic/lib/create-url/main.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { trim } from "es-toolkit/string";
import { isEmpty } from "es-toolkit/compat";
import { mapValues } from "es-toolkit/object";
import { trimStart } from "es-toolkit/string";

import type { CreateUrlInput, CreateUrlOutput } from "./types";

export function createUrl({
fragment,
host,
path,
port,
query,
scheme,
}: CreateUrlInput): CreateUrlOutput {
const trimmedPath = path ? trim(path, "/") : path;
return `${scheme}://${host}${port ? `:${port}` : ""}${trimmedPath ? `/${trimmedPath}` : ""}`;
const basePart =
scheme && host ? `${scheme}://${host}${port ? `:${port}` : ""}` : "";
const pathPart = path ? `/${trimStart(path, "/")}` : "";
const queryPart =
query && !isEmpty(query)
? `?${new URLSearchParams(mapValues(query, (value) => String(value))).toString()}`
: "";
const fragmentPart = fragment ? `#${fragment}` : "";

return basePart + pathPart + queryPart + fragmentPart;
}
16 changes: 15 additions & 1 deletion src/src/common/generic/lib/create-url/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
export type CreateUrlInput = {
type AnyUrlInput = {
fragment?: null | string;
query?: null | { [key: string]: boolean | number | string };
};

type AbsoluteUrlInput = AnyUrlInput & {
host: string;
path?: null | string;
port?: null | number;
scheme: string;
};

type RelativeUrlInput = AnyUrlInput & {
host?: never;
path: string;
port?: never;
scheme?: never;
};

export type CreateUrlInput = AbsoluteUrlInput | RelativeUrlInput;

export type CreateUrlOutput = string;
10 changes: 5 additions & 5 deletions src/src/common/localization/locales/en.po.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"

#: src/client/test/components/test/test-widget/main.tsx:51
#: src/client/test/components/test-widget/main.tsx:51
msgid "An unexpected error occurred"
msgstr "An unexpected error occurred"

#: src/client/test/components/test/test-widget/components/test-form/main.tsx:25
#: src/client/test/components/test-widget/components/test-form/main.tsx:25
msgid "Enter some value"
msgstr "Enter some value"

Expand All @@ -42,8 +42,8 @@ msgstr "{{ appname }} is a Next.js app"
msgid "Info"
msgstr "Info"

#: src/client/test/components/test/test-widget/main.tsx:41
#: src/client/test/components/test/test-widget/main.tsx:61
#: src/client/test/components/test-widget/main.tsx:41
#: src/client/test/components/test-widget/main.tsx:61
msgid "Invalid input"
msgstr "Invalid input"

Expand All @@ -63,7 +63,7 @@ msgstr "Retry"
msgid "Something went wrong"
msgstr "Something went wrong"

#: src/client/test/components/test/test-widget/components/test-form/main.tsx:30
#: src/client/test/components/test-widget/components/test-form/main.tsx:30
msgid "Submit"
msgstr "Submit"

Expand Down
10 changes: 5 additions & 5 deletions src/src/common/localization/locales/pl.po.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"

#: src/client/test/components/test/test-widget/main.tsx:51
#: src/client/test/components/test-widget/main.tsx:51
msgid "An unexpected error occurred"
msgstr "Wystąpił nieoczekiwany błąd"

#: src/client/test/components/test/test-widget/components/test-form/main.tsx:25
#: src/client/test/components/test-widget/components/test-form/main.tsx:25
msgid "Enter some value"
msgstr "Wprowadź jakąś wartość"

Expand All @@ -42,8 +42,8 @@ msgstr "{{ appname }} to aplikacja Next.js"
msgid "Info"
msgstr "Informacja"

#: src/client/test/components/test/test-widget/main.tsx:41
#: src/client/test/components/test/test-widget/main.tsx:61
#: src/client/test/components/test-widget/main.tsx:41
#: src/client/test/components/test-widget/main.tsx:61
msgid "Invalid input"
msgstr "Nieprawidłowe dane wejściowe"

Expand All @@ -63,7 +63,7 @@ msgstr "Spróbuj ponownie"
msgid "Something went wrong"
msgstr "Coś poszło nie tak"

#: src/client/test/components/test/test-widget/components/test-form/main.tsx:30
#: src/client/test/components/test-widget/components/test-form/main.tsx:30
msgid "Submit"
msgstr "Wyślij"

Expand Down
Loading