Skip to content

Commit

Permalink
conflict fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HritvikBhatia committed Oct 11, 2024
2 parents cee2967 + ebe4576 commit 767f381
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 27 deletions.
49 changes: 29 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,24 @@ You can embed one of the available cards in your README using either Markdown **

Here is a list of cards that can currently be used:

| Available Cards | Example | Preview |
| --------------- | ------- | ------- |
| `jokes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/jokes-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/jokes-card?theme=dark) |
| `programming-quotes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-quotes-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-quotes-card) |
| `motivational-quotes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/motivational-quotes-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/motivational-quotes-card) |
| `word-of-the-day-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/word-of-the-day-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/word-of-the-day-card) |
| `challenge-of-the-week-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/challenge-of-the-week-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/challenge-of-the-week-card) |
| `team-work-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/team-work-quote-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/team-work-quote-card) |
| `bhagavad-geeta-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/bhagavad-geeta-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/bhagavad-geeta-card) |
| `random-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-card) |
| `programming-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-facts-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-facts-card?theme=dark) |
| `top-tweets-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/top-tweets-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/top-tweets-card) |
| `spanish-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/spanish-quote-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/spanish-quote-card?theme=dark) |

| `fun-fact-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/fun-fact-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/fun-fact-card?theme=dark) |

| `github-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/github-facts-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/github-facts-card?theme=dark) |
| `random-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-facts-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-facts-card?theme=dark) |
| `breaking-bad-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/breaking-bad-quote-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/breaking-bad-quote-card?theme=dark) |
| `got-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/got-quotes-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/got-quotes-card?theme=dark) |
| Available Cards | Example |
| --------------- | ------- |
| `jokes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/jokes-card?theme=dark)` |
| `programming-quotes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-quotes-card)` |
| `motivational-quotes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/motivational-quotes-card)` |
| `word-of-the-day-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/word-of-the-day-card)` |
| `challenge-of-the-week-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/challenge-of-the-week-card)` |
| `team-work-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/team-work-quote-card)` |
| `bhagavad-geeta-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/bhagavad-geeta-card)` |
| `random-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-card)` |
| `programming-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-facts-card?theme=dark)` |
| `top-tweets-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/top-tweets-card)` |
| `spanish-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/spanish-quote-card?theme=dark)` |
| `fun-fact-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/fun-fact-card?theme=dark)` |
| `github-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/github-facts-card?theme=dark)` |
| `random-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-facts-card?theme=dark)` |
| `breaking-bad-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/breaking-bad-quote-card?theme=dark)` |
| `got-quotes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/got-quotes-card?theme=dark)` |


## Themes
Expand Down Expand Up @@ -137,6 +135,10 @@ args: {
(Limited to HTML Cards)<br>
![Card](https://afraid-ninnetta-github-cards.koyeb.app/motivational-quotes-card?theme=techy)

- #### `Neon_Horizon` Theme Card
(Limited to HTML Cards)<br>
![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-quotes-card?theme=neon_horizon)

## Contributing

### Adding a New Card
Expand All @@ -159,6 +161,13 @@ You can also create cards in HTML and CSS! Check out the `src/cards/motivational
4. Define your theme in `src/themes.js` (refer to existing themes for structure).
5. Update the `src/help.js` file and the `README` with your new theme's API reference.

### Contributing Guidelines
- Ensure your code is properly formatted and follows the existing code style.
- Ensure your code is well-commented and tested before creating a pull request.
- Ensure your card/theme is unique and not a duplicate of an existing card/theme.
- Ensure your card/theme is not offensive or inappropriate.
- Do not commit package-lock.json, yarn.lock, package.json, or any other unnecessary files.

## Additional Information

For more information, visit [https://afraid-ninnetta-github-cards.koyeb.app/](https://afraid-ninnetta-github-cards.koyeb.app/).
22 changes: 15 additions & 7 deletions src/cards/programming-quote.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const express = require("express");
const router = express.Router();
const fs = require("fs").promises;
const { generateCard, CARD_AGE, Languages } = require("../card-generator");
const { generateCard, CARD_AGE, Languages, generateHTMLCard } = require("../card-generator");
const { parseOptions } = require("../options-parser");
const { HTML_THEMES } = require("../html-themes");

const DATA_FILE_PATH = "./src/data/programming_quotes.json";
const DEFAULT_THEME = "dark_2";
Expand All @@ -25,12 +26,19 @@ router.get("/", handleTheme, handleOptions, async (req, res) => {
const random_quote = quotes[Math.floor(Math.random() * quotes.length)];
const quote_content = `${random_quote.quote}\n\n- ${random_quote.author}`;

const quote_card = await generateCard(
quote_content,
req.theme,
req.options,
Languages.ENGLISH
);
let quote_card = "";
let all_html_themes = Object.keys(HTML_THEMES);

if(all_html_themes.includes(req.theme.toUpperCase())) {
quote_card = await generateHTMLCard(quote_content, Languages.ENGLISH, HTML_THEMES[req.theme.toUpperCase()]);
}else{
quote_card = await generateCard(
quote_content,
req.theme,
req.options,
Languages.ENGLISH
);
}

res.writeHead(200, {
"Content-Type": "image/svg+xml",
Expand Down
16 changes: 16 additions & 0 deletions src/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ router.get("/", (req, res) => {
`${baseurl}/random-facts-card?theme=lemonade`,
],
},
"techy": {
info: "Techy theme",
supported_cards: ["programming-quotes-card", "motivational-quotes-card"],
example: [
`${baseurl}/programming-quotes-card?theme=techy`,
`${baseurl}/motivational-quotes-card?theme=techy`,
],
},
"neon_horizon": {
info: "Neon horizon theme",
supported_cards: ["programming-quotes-card", "motivational-quotes-card"],
example: [
`${baseurl}/programming-quotes-card?theme=neon_horizon`,
`${baseurl}/motivational-quotes-card?theme=neon_horizon`,
],
},
"custom": {
info: "Custom theme",
args: {
Expand Down
11 changes: 11 additions & 0 deletions src/html-themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ const HTML_THEMES = {
</div>
<div style="display: flex; width: 100%; height: 2px; background: linear-gradient(90deg, #00ff9d, #00e4ff); margin-top: 15px;"></div>
</div>
`,
'NEON_HORIZON': `
<div style="display: flex;flex-direction: column;align-items: center;justify-content: center;min-width: 200px;max-width: 400px;min-height: 100px;background: linear-gradient(135deg, #0a1128, #1c3f60);border-radius: 20px;box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);overflow: hidden;position: relative;padding: 20px;">
<div style="display: flex;position: absolute;top: 0;left: 0;right: 0;height: 8px;background: linear-gradient(90deg, #00ffff, #ff00ff);"></div>
<div style="display: flex;position: absolute;top: 8px;left: 0;width: 50%;height: 2px;background: #00ffff;"></div>
<div style="display: flex;position: absolute;top: 8px;right: 0;width: 30%;height: 2px;background: #ff00ff;"></div>
<div style="display: flex;position: absolute;bottom: 0;right: 0;width: 100px;height: 100px;background: linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.1) 50%);clip-path: polygon(100% 0, 100% 100%, 0 100%);"></div>
<div style="display: flex;padding: 15px;background: rgba(255, 255, 255, 0.1);border-radius: 10px;border: 1px solid rgba(255, 255, 255, 0.2);max-width: 100%;box-sizing: border-box;">
<span style="font-family: 'Arial', sans-serif;font-size: 11px;font-weight: bold;color: #fff;text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);word-wrap: break-word;max-width: 100%;">{{card_content}}</span>
</div>
</div>
`
};

Expand Down

0 comments on commit 767f381

Please sign in to comment.