Skip to content

Commit

Permalink
Make some basic cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
patdx committed Jan 5, 2025
1 parent 0c2d8ea commit 8c92172
Show file tree
Hide file tree
Showing 17 changed files with 75 additions and 21 deletions.
29 changes: 29 additions & 0 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,35 @@ export function Layout({ children }: { children: React.ReactNode }) {
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover"
/>
<link
rel="manifest"
href="/webmanifest.json"
crossOrigin="use-credentials"
/>
<meta
name="apple-mobile-web-app-status-bar-style"
content="black-translucent"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon-16x16.png"
/>
<meta name="disabled-adaptations" content="watch" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<Meta />
<Links />
</head>
Expand Down
2 changes: 1 addition & 1 deletion app/shared/controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const Controls = observer(() => {
/>

<NumberInput
widthClass="w-20"
className="w-20"
padWidth={3}
value={() => getTimeElapsedAsDuration().milliseconds}
suffix="ms"
Expand Down
3 changes: 1 addition & 2 deletions app/shared/subtitle.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import clsx from 'clsx'
import { getTextSize, getTimeElapsed, nodeIsActive, type Entry } from './utils'
import { observer } from 'mobx-react-lite'

export const Subtitle = observer((props: { node: Entry }) => {
// TODO: decide active node more efficiently
return (
<div
className={clsx(
className={cn(
`text-white`,
getTextSize(),
nodeIsActive(props.node, getTimeElapsed()) && 'font-bold',
Expand Down
16 changes: 7 additions & 9 deletions app/shared/text-input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import clsx from 'clsx'
import { isNil, times } from 'lodash-es'
import { observer } from 'mobx-react-lite'

Expand All @@ -8,7 +7,7 @@ export const NumberInput = observer(
onChange?: (value: number) => unknown
suffix?: string
padWidth?: number
widthClass?: string
className?: string
}) => {
const [mode, setMode] = useSignal('view')

Expand All @@ -21,9 +20,6 @@ export const NumberInput = observer(
? String(resolved)
: ''

// TODO: use the tailwind class merger
const widthClass = () => props.widthClass ?? 'w-10'

function commit(el: HTMLInputElement) {
// compare the normalized values
// to see if anything changed
Expand Down Expand Up @@ -53,9 +49,10 @@ export const NumberInput = observer(
defaultValue={value()}
type="text"
inputMode="numeric"
className={clsx(
className={cn(
`form-input h-10 px-0 py-1 text-center tabular-nums`,
widthClass(),
'w-10',
props.className,
)}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === 'Escape') {
Expand All @@ -70,9 +67,10 @@ export const NumberInput = observer(
} else if (mode() === 'view') {
return (
<button
className={clsx(
className={cn(
'h-10 px-0 py-1 text-center tabular-nums text-gray-200 hover:text-white active:text-white',
widthClass(),
'w-10',
props.className,
)}
// classList={{
// [widthClass]: true,
Expand Down
6 changes: 6 additions & 0 deletions app/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { findLast, once } from 'lodash-es'
import { parse } from '@plussub/srt-vtt-parser'
import { nanoid } from 'nanoid'
import { Duration } from 'luxon'
import { clsx, type ClassValue } from 'clsx'
import { twMerge } from 'tailwind-merge'

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}

export interface Entry {
id: string
Expand Down
1 change: 1 addition & 0 deletions auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ declare global {
const ValueWithPlaceholder: typeof import('./app/shared/text-input')['ValueWithPlaceholder']
const addFileToDatabase: typeof import('./app/shared/utils')['addFileToDatabase']
const clock: typeof import('./app/shared/utils')['clock']
const cn: typeof import('./app/shared/utils')['cn']
const createRef: typeof import('react')['createRef']
const forwardRef: typeof import('react')['forwardRef']
const getActiveNodes: typeof import('./app/shared/utils')['getActiveNodes']
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"react": "19.0.0",
"react-dom": "19.0.0",
"react-router": "7.1.1",
"tailwind-merge": "2.6.0",
"video-name-parser": "1.4.7"
},
"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions public/_headers

This file was deleted.

5 changes: 0 additions & 5 deletions public/_routes.json

This file was deleted.

Binary file added public/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
21 changes: 21 additions & 0 deletions public/webmanifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"short_name": "Subtitle",
"name": "Subtitle App",
"start_url": "/",
"background_color": "#000000",
"display": "standalone",
"scope": "/",
"theme_color": "#000000",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

0 comments on commit 8c92172

Please sign in to comment.