Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to TypeScript and use seatsio-types #135

Merged
merged 40 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6d6e85d
Add TypeScript
mortendevold Sep 21, 2023
81c9b74
Converted to TypeScript
mortendevold Sep 21, 2023
f30cf5f
Move to typescript
mortendevold Sep 22, 2023
0b90463
Fix tests after switching to TypeScript
mortendevold Sep 22, 2023
33bf52c
Simplify jest config
mortendevold Sep 22, 2023
f01e156
Fix Embeddable typings
mortendevold Sep 22, 2023
74ee671
Remove test file
mortendevold Sep 22, 2023
2d8baa6
Remove global directive
mortendevold Sep 22, 2023
418cc54
Update types package name
mortendevold Sep 22, 2023
c8caca4
Use @seatsio/seatsio-types
mortendevold Sep 29, 2023
ed89abf
Add local dependency on @seatsio/seatsio-types (to be replaced)
mortendevold Sep 29, 2023
803c643
Use published version of @seatsio/seatsio-types
mortendevold Oct 3, 2023
7442e16
Make region a required prop, make chartJsUrl a module const
mortendevold Oct 3, 2023
ebf4ad8
Delete chart manager
mortendevold Oct 4, 2023
a1777c0
Remove deleted export
mortendevold Oct 4, 2023
9f37042
Replace multiple uses of any
mortendevold Oct 4, 2023
2907cb8
Merge branch 'master' of https://github.com/seatsio/seatsio-react int…
mortendevold Oct 11, 2023
73dc6f9
Remove tests for deleted implementation
mortendevold Oct 11, 2023
2df2fd9
Fix tests due to defaultProps not being correct
mortendevold Oct 11, 2023
b092f89
Use published version of @seatsio/seatsio-types
mortendevold Oct 11, 2023
b9cb81f
Add type predicates
mortendevold Oct 11, 2023
3ee7142
Use @seatsio/seatsio-types 0.3.0
mortendevold Oct 17, 2023
cf08c06
Add type predicates
mortendevold Oct 17, 2023
40a1e74
Update seatsio-types to 3.0.1
mortendevold Oct 18, 2023
16d5244
seatsio-types upgraded to 0.3.2
mortendevold Oct 18, 2023
1cc8932
Convert playground app to TypeScript
mortendevold Oct 20, 2023
ebca41e
Add dark mode
mortendevold Oct 20, 2023
d085b95
Use specific package versions
mortendevold Oct 20, 2023
d2be842
Merge branch 'master' of https://github.com/seatsio/seatsio-react int…
mortendevold Oct 20, 2023
0a6c5ee
Fix type issue
mortendevold Oct 20, 2023
8d448d4
Updated yarn lock
mortendevold Oct 20, 2023
e6509c8
Add types for react
mortendevold Oct 20, 2023
f547abf
Build with TSC
mortendevold Oct 23, 2023
d6dc137
Convert tests to TypeScript and use TS-Jest
mortendevold Oct 23, 2023
45b1329
Updated license copyright
mortendevold Oct 23, 2023
812a485
Use single bundle file output from TSC
mortendevold Oct 23, 2023
a0958b2
Use webpack to create commonjs bundle
mortendevold Oct 24, 2023
f5394a3
TSC build with ES6 modules
mortendevold Oct 24, 2023
0fb39ae
Add return type on render
mortendevold Oct 24, 2023
03a2dc2
Remove webpack remnants
mortendevold Oct 24, 2023
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
11 changes: 0 additions & 11 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 seats.io
Copyright (c) 2019 - 2023 seats.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
};
32 changes: 13 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"url": "https://github.com/seatsio/seatsio-react"
},
"scripts": {
"build": "webpack",
"prebuild": "rimraf ./build",
"build": "tsc",
"test": "jest"
},
"author": {
Expand All @@ -21,25 +22,18 @@
"react": ">=18.0.0"
},
"devDependencies": {
"webpack": "5.88.2",
"webpack-cli": "5.1.4",
"@babel/cli": "7.22.10",
"@babel/core": "7.23.0",
"babel-loader": "9.1.3",
"@babel/preset-react": "7.22.15",
"@babel/preset-env": "7.22.20",
"react": "18.2.0",
"react-dom": "18.2.0",
"@testing-library/react": "14.0.0",
"@seatsio/seatsio-types": "0.3.2",
"@testing-library/jest-dom": "6.1.3",
"@testing-library/react": "14.0.0",
"@types/jest": "29.5.5",
"@types/react": "18.2.30",
"@types/react-dom": "18.2.14",
"jest": "29.5.0",
"jest-environment-jsdom": "29.7.0"
},
"jest": {
"verbose": true,
"testEnvironment": "jsdom",
"testMatch": [
"<rootDir>/src/test/*.test.js"
]
"jest-environment-jsdom": "29.7.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"rimraf": "5.0.1",
"ts-jest": "29.1.1",
"typescript": "5.2.2"
}
}
2 changes: 0 additions & 2 deletions playground/.npmrc

This file was deleted.

29 changes: 23 additions & 6 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,34 @@
"private": true,
"dependencies": {
"@seatsio/seatsio-react": "file:./..",
"@types/node": "16.18.59",
"@types/react": "18.2.30",
"@types/react-dom": "18.2.14",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-scripts": "5.0.1"
"react-scripts": "5.0.1",
"typescript": "4.9.5"
},
"scripts": {
"start": "react-scripts start"
"start": "react-scripts start",
"build": "react-scripts build"
},
"eslintConfig": {
"extends": "react-app"
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": [
"defaults"
]
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file modified playground/public/favicon.ico
Binary file not shown.
10 changes: 0 additions & 10 deletions playground/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
Expand Down
22 changes: 22 additions & 0 deletions playground/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
text-align: center;
}

.container {
--background-color: #f4f4f4;
--text-color: #121212;

height: 100vh;
background: var(--background-color);
}

.container.dark {
--background-color: #121212;
--text-color: rgb(244, 244, 244);
}

h1 {
color: var(--text-color);
}

select {
background: var(--background-color);
color: var(--text-color);
}

#chart {
height: 600px;
}
50 changes: 0 additions & 50 deletions playground/src/App.js

This file was deleted.

37 changes: 37 additions & 0 deletions playground/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { SeatsioSeatingChart } from '@seatsio/seatsio-react';
import React, { useState } from 'react';
import './App.css';

type ColorScheme = 'light' | 'dark'

export const App = () => {
const [unusedState, setUnusedState] = useState(0)
const [colorScheme, setColorScheme] = useState<ColorScheme>('light')

return (
<div className={['container', colorScheme].join(' ')}>
<div className="App">
<select onChange={e => setColorScheme(e.target.value as ColorScheme)} value={colorScheme}>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
<select onChange={e => setUnusedState(parseInt(e.target.value))} value={unusedState}>
<option>0</option>
<option>1</option>
</select>
<h1>Seats.io React playground</h1>
<div id="chart">
<SeatsioSeatingChart
workspaceKey="publicDemoKey"
event="smallTheatreEvent1"
colorScheme={colorScheme}
region="eu"
chartJsUrl="https://cdn-staging-{region}.seatsio.net/chart.js"
/>
</div>
</div>
</div>
)
}

export default App
6 changes: 3 additions & 3 deletions playground/src/index.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
8 changes: 0 additions & 8 deletions playground/src/index.js

This file was deleted.

13 changes: 13 additions & 0 deletions playground/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';

const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
1 change: 1 addition & 0 deletions playground/src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="react-scripts" />
26 changes: 26 additions & 0 deletions playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
Loading
Loading