Skip to content

Commit

Permalink
upgrade and use prettier defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyBurger committed Apr 27, 2024
1 parent b9ea9ca commit aeac403
Show file tree
Hide file tree
Showing 17 changed files with 833 additions and 846 deletions.
13 changes: 0 additions & 13 deletions .prettierrc

This file was deleted.

6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"editor.tabSize": 2,
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
"editor.tabSize": 2,
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"remotion": "^4.0.0",
"zod": "^3.21.4"
"zod": "3.22.3"
},
"devDependencies": {
"@remotion/eslint-config": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions remotion.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Config} from '@remotion/cli/config';
import { Config } from "@remotion/cli/config";

/**
* Note: When using the Node.JS APIs, the config file
* doesn't apply. Instead, pass options directly to the APIs
*/

Config.setVideoImageFormat('jpeg');
Config.setVideoImageFormat("jpeg");
Config.setDelayRenderTimeoutInMilliseconds(1200000);
292 changes: 146 additions & 146 deletions src/Content.tsx
Original file line number Diff line number Diff line change
@@ -1,162 +1,162 @@
import {Img, useVideoConfig} from 'remotion';
import {Stargazer} from './cache';
import {RepoHeader} from './repo-header';
import { Img, useVideoConfig } from "remotion";
import { Stargazer } from "./cache";
import { RepoHeader } from "./repo-header";

const W = 1280 / 2.5;
const H = 720 / 2.5;

export function Content({
stargazers,
repoOrg,
repoName,
progress,
stargazers,
repoOrg,
repoName,
progress,
}: {
stargazers: Stargazer[];
repoOrg: string;
repoName: string;
progress: number;
stargazers: Stargazer[];
repoOrg: string;
repoName: string;
progress: number;
}) {
const gap = 102;
const startY = 76 - gap;
const dy = progress * gap;
const {width} = useVideoConfig();
const gap = 102;
const startY = 76 - gap;
const dy = progress * gap;
const { width } = useVideoConfig();

return (
<div
style={{
flex: 1,
backgroundColor: '#f6f8fa',
position: 'relative',
maxWidth: W,
maxHeight: H,
minHeight: H,
transformOrigin: 'top left',
transform: `scale(${width / W})`,
}}
>
{stargazers.map((stargazer, index) => {
const isHidden = Math.abs(index - progress) > 3;
const grow = 0;
const opacity = Math.min(0.1 + progress - index, 1);
return isHidden ? null : (
<StarBox
key={stargazer.login}
avatarUrl={stargazer.avatarUrl}
name={stargazer.name}
date={stargazer.date}
repoName={repoName}
y={startY - gap * index + dy}
grow={grow}
opacity={opacity}
starNumber={index + 1}
/>
);
})}
return (
<div
style={{
flex: 1,
backgroundColor: "#f6f8fa",
position: "relative",
maxWidth: W,
maxHeight: H,
minHeight: H,
transformOrigin: "top left",
transform: `scale(${width / W})`,
}}
>
{stargazers.map((stargazer, index) => {
const isHidden = Math.abs(index - progress) > 3;
const grow = 0;
const opacity = Math.min(0.1 + progress - index, 1);
return isHidden ? null : (
<StarBox
key={stargazer.login}
avatarUrl={stargazer.avatarUrl}
name={stargazer.name}
date={stargazer.date}
repoName={repoName}
y={startY - gap * index + dy}
grow={grow}
opacity={opacity}
starNumber={index + 1}
/>
);
})}

<RepoHeader stars={Math.round(progress)} org={repoOrg} name={repoName} />
</div>
);
<RepoHeader stars={Math.round(progress)} org={repoOrg} name={repoName} />
</div>
);
}

function StarBox({
avatarUrl,
name,
date,
repoName,
y,
starNumber,
grow,
opacity,
avatarUrl,
name,
date,
repoName,
y,
starNumber,
grow,
opacity,
}: {
avatarUrl: string;
name: string;
date: string;
repoName: string;
y: number;
starNumber: number;
grow: number;
opacity: number;
avatarUrl: string;
name: string;
date: string;
repoName: string;
y: number;
starNumber: number;
grow: number;
opacity: number;
}) {
const d = new Date(date);
const dateString = d.toLocaleDateString('en-US', {
month: 'short',
day: '2-digit',
year: 'numeric',
});
const d = new Date(date);
const dateString = d.toLocaleDateString("en-US", {
month: "short",
day: "2-digit",
year: "numeric",
});

return (
<div
style={{
background: 'white',
border: '1px solid #e1e4e8',
borderRadius: 6,
padding: 12,
display: 'flex',
position: 'absolute',
opacity,
top: 0,
right: 24,
left: 24,
height: 88,
minHeight: 88,
maxHeight: 88,
transform: `translateY(${y}px) scale(${1 + grow * 0.07})`,
}}
>
<Img
width="64"
height="64"
src={avatarUrl}
style={{borderRadius: '50%'}}
/>
<div
style={{
display: 'flex',
flexDirection: 'column',
marginLeft: '12px',
flex: 1,
maxWidth: 560,
minWidth: 0,
}}
>
<h3
style={{
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
maxWidth: 360,
fontWeight: 400,
}}
>
{name}
</h3>
<div
style={{
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
}}
>
starred <b>{repoName}</b>{' '}
<span style={{color: '#586069'}}>on {dateString}</span>
</div>
</div>
<div
style={{
width: 64,
height: 64,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
}}
>
<span style={{fontSize: '0.8em', color: '#586069'}}>Star</span>
<div style={{fontSize: '1.2em'}}>
<span style={{fontSize: '1em', color: '#586069'}}>#</span>
{starNumber}
</div>
</div>
</div>
);
return (
<div
style={{
background: "white",
border: "1px solid #e1e4e8",
borderRadius: 6,
padding: 12,
display: "flex",
position: "absolute",
opacity,
top: 0,
right: 24,
left: 24,
height: 88,
minHeight: 88,
maxHeight: 88,
transform: `translateY(${y}px) scale(${1 + grow * 0.07})`,
}}
>
<Img
width="64"
height="64"
src={avatarUrl}
style={{ borderRadius: "50%" }}
/>
<div
style={{
display: "flex",
flexDirection: "column",
marginLeft: "12px",
flex: 1,
maxWidth: 560,
minWidth: 0,
}}
>
<h3
style={{
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
maxWidth: 360,
fontWeight: 400,
}}
>
{name}
</h3>
<div
style={{
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
>
starred <b>{repoName}</b>{" "}
<span style={{ color: "#586069" }}>on {dateString}</span>
</div>
</div>
<div
style={{
width: 64,
height: 64,
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
}}
>
<span style={{ fontSize: "0.8em", color: "#586069" }}>Star</span>
<div style={{ fontSize: "1.2em" }}>
<span style={{ fontSize: "1em", color: "#586069" }}>#</span>
{starNumber}
</div>
</div>
</div>
);
}
Loading

0 comments on commit aeac403

Please sign in to comment.