Skip to content

Commit dd2c82a

Browse files
committed
chore: cleanup, Docs update and few other minor fixes
1 parent ecf95ec commit dd2c82a

File tree

7 files changed

+67
-25
lines changed

7 files changed

+67
-25
lines changed

.vscode/settings.json

-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,4 @@
22
"eslint.format.enable": true,
33
"eslint.debug": true,
44
"eslint.packageManager": "yarn",
5-
"cSpell.words": [
6-
"Giphy",
7-
"fastimage"
8-
]
95
}

README.md

+22-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
# Webembeds (⚠️ Not to be used in production yet)
22
Built and supported by [Hashnode](https://hashnode.com)
33

4-
- Checkout demo here https://webembeds.com
4+
- Checkout demo here https://webembeds.com/demo
55

6-
This project started to replace Hashnode's embedding logic and rely on something more flexible.
6+
This project is in its very infant stage. There is high scope of improvement here and we have some plans for improvements and stability. We would appreciate any kind of contribution to this project.
77

8-
## Current status
8+
## Development
9+
- Run `yarn` within the repo
10+
- Run `core:watch` to start the website in development mode
11+
- Run `website:dev` to start the website in development mode (Make sure to rerun when you change @webembeds/core files)
12+
13+
## Host it anywhere
14+
- Clone the repo
15+
- Run `yarn` within the repo
16+
- `yarn build-all && yarn website:start`
17+
- Visit http://localhost:3000
918

1019
## Contributing
1120
- We will be working mainly on `development` branch and the `master` branch remains untouched.
1221
- Create feature branches checked out from `development` branch and raise PR against `development` once done.
1322
- Continuous deployment is setup for `development` branch to be deployed to https://staging.webembeds.com and the master branch to https://webembeds.com
1423

24+
Clone the repo and run
25+
26+
`yarn` and checkout package.json for all available scripts.
27+
28+
## Bugs, Future plans and Improvements
29+
30+
Please visit [issue section](https://github.com/Hashnode/webembeds/issues) of this repo.
31+
1532
### Commit style
16-
We follow conventional commits specs (https://www.conventionalcommits.org/en/v1.0.0/) and suggest you to install https://github.com/commitizen/cz-cli.
17-
Once done you can run `git cz` to commit your changes.
33+
We follow conventional commits specs (https://www.conventionalcommits.org/en/v1.0.0/).
34+
Once done you can run `git cz` or `yarn commit` to commit your changes.

packages/webembeds-core/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ The build file can be imported elsewhere and used directly
1414
const webembed = require("../build/bundle");
1515
(async function () {
1616
try {
17-
const url = links.expo;
1817
const output = await webembed.default("https://www.youtube.com/watch?v=32I0Qso4sDg");
1918
console.log("Embed output", output);
2019
} catch (error) {
@@ -29,6 +28,5 @@ const webembed = require("../build/bundle");
2928
## Future plans
3029
[-] Ship `@webembeds/core` as a separate npm package.
3130

32-
3331
## Contributing
3432
Please check this README.md on instructions to contributing. https://github.com/Hashnode/webembeds/blob/master/README.md

packages/webembeds-website/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# webembeds-website
22
Built and supported by [Hashnode](https://hashnode.com)
33

4-
- Checkout demo here https://webembeds.com
4+
- Checkout demo here https://webembeds.com/demo
55

66
This package deals with the website. Right now website only hosts a demo of webembeds.
77

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from "react";
2+
import Document, { Html, Head, Main, NextScript } from "next/document";
3+
4+
class CustomDocument extends Document {
5+
render() {
6+
return (
7+
<Html>
8+
<Head />
9+
<body>
10+
<Main />
11+
<NextScript />
12+
<script async defer src="/js/buttons.js"></script>
13+
</body>
14+
</Html>
15+
);
16+
}
17+
}
18+
19+
export default CustomDocument;

packages/webembeds-website/pages/demo.tsx

+19-13
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@ import React, { useState, useEffect, useRef } from "react";
33
import Loader from "../components/Loader";
44

55
const links: any = {
6-
spotify: "https://open.spotify.com/track/3G8o2zm7LaF6eeVuvLlrkJ?si=Sx1sCnhDT6GXqSLIwSLOeQ",
6+
// spotify: "https://open.spotify.com/track/3G8o2zm7LaF6eeVuvLlrkJ?si=Sx1sCnhDT6GXqSLIwSLOeQ",
77
// gist: "https://gist.github.com/theevilhead/7ac2fbc3cda897ebd87dbe9aeac130d6",
8+
// canva1: "https://www.canva.com/design/DAEWSa9kfIs/view",
9+
// canva2: "https://www.canva.com/design/DAEWRhUKdvg/view",
10+
// twitter: "https://twitter.com/hashnode/status/1352525138659430400",
11+
// expo: "https://snack.expo.io/@girishhashnode/unnamed-snack",
12+
// runkit: "https://runkit.com/runkit/welcome",
813
canva: "https://www.canva.com/design/DAET1m0_11c/jFBlYrKc8CQCb2boU9KC-A/view",
9-
canva1: "https://www.canva.com/design/DAEWSa9kfIs/view",
10-
canva2: "https://www.canva.com/design/DAEWRhUKdvg/view",
1114
codepen: "https://codepen.io/bsehovac/pen/EMyWVv",
1215
youtube: "https://www.youtube.com/watch?v=32I0Qso4sDg",
13-
twitter: "https://twitter.com/hashnode/status/1352525138659430400",
1416
glitch: "https://glitch.com/edit/#!/remote-hands",
15-
expo: "https://snack.expo.io/@girishhashnode/unnamed-snack",
1617
twitch: "https://www.twitch.tv/fresh",
1718
giphy: "https://giphy.com/gifs/cbsnews-inauguration-2021-XEMbxm9vl9JIIMcE7M",
1819
metascraper: "https://metascraper.js.org/",
19-
runkit: "https://runkit.com/runkit/welcome",
2020
repl: "https://repl.it/@GirishPatil4/AdvancedRespectfulGigahertz",
2121
soundcloud: "https://soundcloud.com/hit-jatt/jatt-disde-arjan-dhillon",
2222
anchor: "https://anchor.fm/startapodcast/episodes/Whats-your-podcast-about-e17krq/a-a2q3ft",
2323
loom: "https://www.loom.com/share/0281766fa2d04bb788eaf19e65135184",
24-
vimeo: "https://vimeo.com/336812660",
25-
fallback: "https://hashnode.com",
24+
vimeo: "https://vimeo.com/485593347",
25+
fallback: "https://github.com",
2626
};
2727

2828
function Demo() {
2929
const urlRef = useRef<HTMLInputElement>(null);
30-
const [result, setResult] = useState<{ output: { html?: string }; error: boolean }>();
30+
const [result, setResult] = useState<{ output?: { html?: string }; error: boolean } | null>();
3131
const [isLoading, setLoading] = useState<boolean>(false);
3232

3333
useEffect(() => {
34-
handleURL(links.anchor);
34+
handleURL(links.vimeo);
3535
}, []);
3636

3737
const handleURL = async (incomingURL?: string) => {
@@ -49,6 +49,7 @@ function Demo() {
4949
}
5050

5151
setLoading(true);
52+
setResult(null);
5253

5354
const requestURL = `/api/embed?url=${encodeURIComponent(url)}`;
5455
const response = await fetch(requestURL, {
@@ -67,8 +68,13 @@ function Demo() {
6768

6869
return (
6970
<div className="w-full mx-auto max-w-4xl">
70-
<div className="max-w-3xl mx-auto">
71-
<h1 className="text-xl font-semibold py-6 px-3">Webembeds</h1>
71+
<div className="max-w-3xl mx-auto flex flex-wrap items-center justify-between">
72+
<a href="/" className="text-xl font-semibold py-6 px-3">Webembeds</a>
73+
<div>
74+
{/* <a className="github-button" href="https://github.com/hashnode" data-size="large" aria-label="Follow @hashnode on GitHub">Follow @hashnode</a>
75+
&nbsp; */}
76+
<a className="github-button" href="https://github.com/hashnode/webembeds" data-color-scheme="no-preference: light; light: dark; dark: dark;" data-icon="octicon-star" data-size="large" aria-label="Star hashnode/webembeds on GitHub">Star us on Github</a>
77+
</div>
7278
</div>
7379

7480
<div className="flex flex-col">
@@ -79,7 +85,7 @@ function Demo() {
7985
{result && !result.error && !isLoading ? (
8086
<div
8187
className="shadow-2xl p-2 bg-white rounded-sm border border-gray-200"
82-
dangerouslySetInnerHTML={{ __html: result.output.html || "" }}
88+
dangerouslySetInnerHTML={{ __html: (result.output && result.output.html) ? result.output.html : "" }}
8389
/>
8490
) : null}
8591
{result && result.error ? "Something went wrong" : ""}

0 commit comments

Comments
 (0)