Skip to content

Commit

Permalink
Merge pull request #95 from VampireChicken12/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
VampireChicken12 authored Nov 15, 2023
2 parents d6bc179 + ddd44d0 commit cff8c4b
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 43 deletions.
10 changes: 6 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,19 @@
"no-useless-escape": "off",
"no-empty": ["error", { "allowEmptyCatch": true }],
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
"import/no-commonjs": "error",
"import/first": ["error"],
"no-secrets/no-secrets": "error",
"prettier/prettier": [
"error",
{
"useTabs": true,
"arrowParens": "always",
"endOfLine": "lf",
"printWidth": 150,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "none",
"arrowParens": "always",
"printWidth": 150
"useTabs": true
}
],
"import/no-unresolved": "off",
Expand Down
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ updates:
interval: "weekly"
target-branch: "dev"
versioning-strategy: "increase-if-necessary"

2 changes: 1 addition & 1 deletion nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"watch": ["src", "utils", "vite.config.ts", "public", "public/locales"],
"ext": "ts,tsx,css,html,json",
"ignore": ["src/**/*.spec.ts", "public/locales/en-US.json.d.ts"],
"exec": "concurrently \"vite build\" \"ts-json-as-const public/locales/en-US.json\" \"prettier --write public/locales/en-US.json.d.ts\""
"exec": "concurrently \"vite build\" \"ts-json-as-const public/locales/en-US.json\" \"prettier --write public/locales/en-US.json.d.ts\" \"eslint --fix public/locales/en-US.json.d.ts\""
}
4 changes: 2 additions & 2 deletions postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
plugins: {
"@thedutchcoder/postcss-rem-to-px": {},
tailwindcss: {},
autoprefixer: {}
autoprefixer: {},
tailwindcss: {}
}
};
10 changes: 5 additions & 5 deletions prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/** @type {import("prettier").Config} */
module.exports = {
useTabs: true,
semi: true,
trailingComma: "none",
arrowParens: "always",
tabWidth: 2,
endOfLine: "lf",
printWidth: 150,
semi: true,
singleQuote: false,
endOfLine: "lf"
tabWidth: 2,
trailingComma: "none",
useTabs: true
};
1 change: 0 additions & 1 deletion public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"settings": {
"sections": {
"importExportSettings": {
"title": "Import/Export Settings",
"importButton": {
"error": {
"validation": "Error importing settings. Please check the file format.\n{{ERROR_MESSAGE}}",
Expand Down
1 change: 0 additions & 1 deletion public/locales/en-US.json.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ interface EnUS {
title: "Import settings from a JSON file";
value: "Import Settings";
};
title: "Import/Export Settings";
};
language: {
select: { label: "Language"; title: "The language to use for the extension" };
Expand Down
5 changes: 4 additions & 1 deletion src/@types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ type TypeToZod<T> = {
: z.ZodType<T[K]>
: z.ZodObject<TypeToZod<T[K]>>;
};
export type PartialConfigurationToZodSchema<T> = z.ZodObject<{
export type TypeToZodSchema<T> = z.ZodObject<{
[K in keyof T]: T[K] extends object ? z.ZodObject<TypeToZod<T[K]>> : z.ZodType<T[K]>;
}>;
export type TypeToPartialZodSchema<T> = z.ZodObject<{
[K in keyof T]: T[K] extends object ? z.ZodObject<TypeToZod<T[K]>> : z.ZodOptionalType<z.ZodType<T[K]>>;
}>;
export type Prettify<T> = {
Expand Down
42 changes: 17 additions & 25 deletions src/components/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,28 +356,6 @@ export default function Settings({
t={i18nInstance.t}
/>
</Suspense>
<SettingSection>
<SettingTitle title={t("settings.sections.importExportSettings.title")} />
<div className="flex gap-1 p-2">
<input
className="accent p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
id="import_settings_button"
onClick={importSettings}
title={t("settings.sections.importExportSettings.importButton.title")}
type="button"
value={t("settings.sections.importExportSettings.importButton.value")}
/>
<input
className="accent p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
id="export_settings_button"
onClick={exportSettings}
style={{ marginLeft: "auto" }}
title={t("settings.sections.importExportSettings.exportButton.title")}
type="button"
value={t("settings.sections.importExportSettings.exportButton.value")}
/>
</div>
</SettingSection>
<SettingSection>
<SettingTitle title={t("settings.sections.miscellaneous.title")} />
<Setting
Expand Down Expand Up @@ -613,7 +591,7 @@ export default function Settings({
type="select"
/>
</SettingSection>
<div className="sticky bottom-0 left-0 flex gap-1 bg-[#f5f5f5] p-2 dark:bg-[#181a1b]">
<div className="sticky bottom-0 left-0 flex justify-between gap-1 bg-[#f5f5f5] p-2 dark:bg-[#181a1b]">
<input
className="danger p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
id="clear_data_button"
Expand All @@ -622,6 +600,22 @@ export default function Settings({
type="button"
value={t("settings.sections.bottomButtons.clear.value")}
/>
<input
className="accent p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
id="import_settings_button"
onClick={importSettings}
title={t("settings.sections.importExportSettings.importButton.title")}
type="button"
value={t("settings.sections.importExportSettings.importButton.value")}
/>
<input
className="accent p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
id="export_settings_button"
onClick={exportSettings}
title={t("settings.sections.importExportSettings.exportButton.title")}
type="button"
value={t("settings.sections.importExportSettings.exportButton.value")}
/>
{notifications.filter((n) => n.action === "reset_settings").length > 0 ? (
<input
className="danger p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
Expand All @@ -636,7 +630,6 @@ export default function Settings({

addNotification("success", t("pages.options.notifications.success.saved"));
}}
style={{ marginLeft: "auto" }}
title={t("settings.sections.bottomButtons.confirm.title")}
type="button"
value={t("settings.sections.bottomButtons.confirm.value")}
Expand All @@ -646,7 +639,6 @@ export default function Settings({
className="warning p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
id="reset_button"
onClick={resetOptions}
style={{ marginLeft: "auto" }}
title={t("settings.sections.bottomButtons.reset.title")}
type="button"
value={t("settings.sections.bottomButtons.reset.value")}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import z from "zod";

import type { PartialConfigurationToZodSchema, configuration } from "../@types";
import type { TypeToPartialZodSchema, configuration } from "../@types";

import {
onScreenDisplayColor,
Expand Down Expand Up @@ -42,7 +42,7 @@ export const defaultConfiguration = {
volume_boost_amount: 1
} satisfies configuration;

export const configurationImportSchema: PartialConfigurationToZodSchema<configuration> = z.object({
export const configurationImportSchema: TypeToPartialZodSchema<configuration> = z.object({
enable_automatically_set_quality: z.boolean().optional(),
enable_forced_playback_speed: z.boolean().optional(),
enable_hide_scrollbar: z.boolean().optional(),
Expand Down

0 comments on commit cff8c4b

Please sign in to comment.