Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: patdx/subtitle-app
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0
Choose a base ref
...
head repository: patdx/subtitle-app
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 13 commits
  • 56 files changed
  • 2 contributors

Commits on Jan 4, 2025

  1. Copy the full SHA
    0c2d8ea View commit details

Commits on Jan 5, 2025

  1. Make some basic cleanup

    patdx committed Jan 5, 2025
    Copy the full SHA
    8c92172 View commit details
  2. Add beta transcript mode

    patdx committed Jan 5, 2025
    Copy the full SHA
    1d358e6 View commit details
  3. Fix some bugs

    patdx committed Jan 5, 2025
    Copy the full SHA
    544a6d0 View commit details
  4. Copy the full SHA
    a93b7b5 View commit details
  5. Update app.css

    patdx authored Jan 5, 2025
    Copy the full SHA
    03d8010 View commit details

Commits on Jan 6, 2025

  1. Add about page

    patdx committed Jan 6, 2025
    Copy the full SHA
    8e7794a View commit details
  2. Add more applike css

    patdx committed Jan 6, 2025
    Copy the full SHA
    ba4e977 View commit details

Commits on Jan 13, 2025

  1. Create devcontainer.json

    patdx authored Jan 13, 2025
    Copy the full SHA
    98aae6b View commit details
  2. Add more app like css

    patdx committed Jan 13, 2025
    Copy the full SHA
    92b2482 View commit details

Commits on Jan 22, 2025

  1. Update dependency vite to v6.0.9 [SECURITY] (#741)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 22, 2025
    Copy the full SHA
    5b4e722 View commit details

Commits on Feb 12, 2025

  1. Update dependency esbuild to v0.25.0 [SECURITY] (#742)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 12, 2025
    Copy the full SHA
    d01a462 View commit details

Commits on Mar 1, 2025

  1. Update dependency mobx to v6.13.6 (#743)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 1, 2025
    Copy the full SHA
    d6b797f View commit details
Showing with 4,241 additions and 1,697 deletions.
  1. +22 −0 .devcontainer/devcontainer.json
  2. +9 −7 .editorconfig
  3. +9 −9 .gitignore
  4. +0 −7 .gitpod.yml
  5. +1 −0 .node-version
  6. +1 −0 .npmrc
  7. +3 −4 .prettierignore
  8. +1 −3 .prettierrc
  9. +0 −11 .vscode/settings.json
  10. +73 −8 README.md
  11. +20 −0 TODO.md
  12. +24 −0 app/.server/context.ts
  13. +68 −0 app/app.css
  14. 0 {src → app}/assets/sample.srt
  15. 0 src/types/video-name-parser.d.ts → app/env.d.ts
  16. +155 −0 app/root.tsx
  17. +4 −0 app/routes.ts
  18. +206 −0 app/routes/_index.tsx
  19. +56 −0 app/routes/about.tsx
  20. +43 −0 app/routes/play.tsx
  21. +13 −0 app/shared/badge.tsx
  22. +73 −70 {src/components → app/shared}/controls.tsx
  23. +20 −0 app/shared/file-display.tsx
  24. +58 −26 {src/components → app/shared}/icons.tsx
  25. +56 −0 app/shared/solid-helpers.tsx
  26. +43 −0 app/shared/subtitle.tsx
  27. +105 −0 app/shared/text-input.tsx
  28. +19 −0 app/shared/transcript-display.tsx
  29. +133 −33 {src → app/shared}/utils.ts
  30. +74 −0 auto-imports.d.ts
  31. +199 −0 docs/konsta-buttons.tsx
  32. +257 −0 docs/konsta-list.tsx
  33. +62 −49 package.json
  34. +2,313 −779 pnpm-lock.yaml
  35. +0 −6 postcss.config.cjs
  36. +19 −19 public/webmanifest.json
  37. +14 −0 react-router.config.ts
  38. +2 −2 renovate.json
  39. +0 −13 src/components/badge.tsx
  40. +0 −19 src/components/file-display.tsx
  41. +0 −15 src/components/subtitle.tsx
  42. +0 −103 src/components/text-input.tsx
  43. +0 −192 src/pages/+Page.tsx
  44. +0 −48 src/pages/play/+Page.tsx
  45. +0 −8 src/renderer/+config.ts
  46. +0 −24 src/renderer/+onRenderClient.tsx
  47. +0 −71 src/renderer/+onRenderHtml.tsx
  48. +0 −20 src/renderer/styles.css
  49. +0 −13 src/renderer/types.ts
  50. +0 −53 src/server/index.js
  51. +0 −17 tailwind.config.cjs
  52. +16 −0 tailwind.config.ts
  53. +28 −0 tsconfig.cloudflare.json
  54. +12 −15 tsconfig.json
  55. +13 −0 tsconfig.node.json
  56. +17 −53 vite.config.ts
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "Node.js",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bullseye"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
16 changes: 9 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 2

# YAML doesn't support hard tabs 🙃
# Templates that will be weird with hard tabs in the website editor
[{**.yml,**.yaml,**.md,**.rs,**.mdx,justfile,**.json}]
indent_style = space
18 changes: 9 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
node_modules
dist
.DS_Store
/node_modules/

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# React Router
/.react-router/
/build/

# Cloudflare
.mf
.wrangler
7 changes: 0 additions & 7 deletions .gitpod.yml

This file was deleted.

1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-prefix=
7 changes: 3 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.yarn
dist
node_modules
pnpm-lock.yaml
/pnpm-lock.yaml
/build/**/*
/auto-imports.d.ts
4 changes: 1 addition & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"singleQuote": true,
"semi": false,
"tabWidth": 2,
"useTabs": true
"semi": false
}
11 changes: 0 additions & 11 deletions .vscode/settings.json

This file was deleted.

81 changes: 73 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,80 @@
# subtitle-app
# patdx-remix-template

## Access here: https://subtitle-app.vercel.app/
## Create a new project from this template

This is an open-source application to play a subtitle file as if it were a video.
This will copy the code in `main` branch to a new directory.

It supports SRT files or ZIP archives with SRT files inside.
```
npx degit patdx/patdx-remix-template
```

It can be useful to enjoy content in a second subtitle language.
## Summary

There are similar tools for computers such as [Language Reactor](https://www.languagereactor.com/) extension but I could not find any good tool that can be used with your TV.
This is a template for React Router 7 (Remix) apps with the following features already set up:

With this app, you can play the main content via the regular streaming app on your TV, then open up Subtitle App on any old phone/table, queue up the subtitles file and place it next to the TV.
- Cloudflare Pages Functions deployment using wrangler.toml
- React 19
- Auto import plugin with React imports set up
- Tailwind CSS

I have used it to watch some K-dramas with my partner as both of us have different preferred languages for watching TV, and neither of us know Korean.
It is largely based on the [React Router 7 Cloudflare D1 Template](https://github.com/remix-run/react-router-templates/tree/main/cloudflare-d1) but using Cloudflare Pages instead of the new Cloudflare Worker Assets feature, and a different plugin to use Worker Proxy mode instead of the Vite Environments API.

## Adding Node-targeted modules

If you need to use a module that is targeted for Node, try adding `nodejs_compat` to the wrangler.json:

```json
{
"compatibility_flags": ["nodejs_compat"]
}
```

And add the module to the SSR externals list in vite.config.ts:

```diff
ssr: {
external: [
'node:async_hooks',
+ 'nodemailer',
],
},
```

## Development

Run the dev server:

```sh
pnpm dev
```

To run Wrangler:

```sh
pnpm build
pnpm start
```

## Deployment

> [!WARNING]
> Cloudflare does _not_ use `wrangler.toml` to configure deployment bindings.
> You **MUST** [configure deployment bindings manually in the Cloudflare dashboard][bindings].
First, build your app for production:

```sh
pnpm build
```

Then, deploy your app to Cloudflare Pages:

```sh
pnpm run deploy
```

[bindings]: https://developers.cloudflare.com/pages/functions/bindings/

## Styling

This template comes with [Tailwind CSS](https://tailwindcss.com/) already configured for a simple default starting experience. You can use whatever css framework you prefer. See the [Vite docs on css](https://vitejs.dev/guide/features.html#css) for more information.
20 changes: 20 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- fix speed selector
- fix background for black player page
- track time for each episode separately
- remember last time for each episode
- next episode button
- markup support
- have it fade out after a few seconds
- add padding
- add more options to change the font size
- auto shrink large text if it does not fit
- fix theme color/background color
- show title of program inside details page
- syncing between devices
- use evolu or one(?) that crsqlite related thing
- better ui for navigating time
- like +10s -10s
- or a dial
- or tapping text in the transcript view
- fix darkmode
- the number inputs seem to have white text in white bg in dark mode
24 changes: 24 additions & 0 deletions app/.server/context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { AsyncLocalStorage } from 'node:async_hooks'

export interface MyCloudflareEnvironment {
VALUE_FROM_CLOUDFLARE: string
}

export interface MyAppLoadContext {
request: Request
env: MyCloudflareEnvironment
executionCtx: ExecutionContext
[key: string]: unknown
}

declare module 'react-router' {
interface AppLoadContext extends MyAppLoadContext {}
}

export const MyAppLoadContext = new AsyncLocalStorage<MyAppLoadContext>()

export function getMyAppLoadContext() {
const ctx = MyAppLoadContext.getStore()
if (!ctx) throw new Error('MyAppLoadContext not found')
return ctx
}
68 changes: 68 additions & 0 deletions app/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

/*
Allow pan but disable zoom to avoid messing up the UI chrome
I found that I need to set it on all elements (*) to be effective in iOS Safari mode
I guess I could manually override certain elements that need other gestures later
*/
html,
body,
#app,
* {
touch-action: pan-x pan-y;
}

/* https://x.com/morajabi/status/1846583265072660939 */
* {
user-select: none;
user-drag: none;
app-region: no-drag;
}

/* https://forums.developer.apple.com/forums/thread/133399 */
html {
-webkit-touch-callout: none; /* Safari Touch */
-webkit-user-select: none; /* Webkit */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Edge*/
user-select: none; /* Future-proof*/

-webkit-user-drag: none;
-moz-user-drag: none;
-o-user-drag: none;
user-drag: none;
}

html {
overscroll-behavior: none;
}

/* https://github.com/ionic-team/ionic-framework/blob/1b11b82eaaa0982f98547f2854563517174c865c/core/src/css/structure.scss#L75 */
/* https://www.heltweg.org/posts/checklist-issues-progressive-web-apps-how-to-fix/ */

body {
user-select: none;
text-rendering: optimizeLegibility;

overflow: hidden;

/* touch-action: manipulation; */

-webkit-user-drag: none;

-ms-content-zooming: none;

word-wrap: break-word;

overscroll-behavior-y: none;
-webkit-text-size-adjust: none;

text-size-adjust: none;

/* Should we use any of the properties set here? https://github.com/ionic-team/ionic-framework/blob/1b11b82eaaa0982f98547f2854563517174c865c/core/src/css/structure.scss#L75 */
/* transform: translateZ(0);
*/
}
File renamed without changes.
File renamed without changes.
Loading