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

WIP: Migrate to Tailwindcss #2469

Open
wants to merge 70 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
5521a7f
update nav
dekkerglen Oct 1, 2024
8528b99
Finish landing page
dekkerglen Oct 3, 2024
c1026cd
Finish card packages
dekkerglen Oct 5, 2024
657234f
upgrade article and articles pages
dekkerglen Oct 5, 2024
c0c9eba
Comment sections
dekkerglen Oct 6, 2024
80a1d5f
migrate card pages
dekkerglen Oct 6, 2024
324d96d
finish card search page
dekkerglen Oct 6, 2024
a7b29e9
card search page
dekkerglen Oct 6, 2024
506fe67
migrate comment page
dekkerglen Oct 7, 2024
c6a8c7b
Migrate contact page
dekkerglen Oct 7, 2024
fe2a6d2
migrated content creator dashboard
dekkerglen Oct 7, 2024
2f2d6b1
Migrate analysis page
dekkerglen Oct 10, 2024
1edebd2
migrate cube blog page
dekkerglen Oct 10, 2024
03abd96
finish playtest page
dekkerglen Oct 12, 2024
09a2517
Update CustomDraftFormatModal.tsx
dekkerglen Oct 12, 2024
46355bf
start cube sample pack page
dekkerglen Oct 13, 2024
81a2803
migrate sample pack page
dekkerglen Oct 13, 2024
e311259
migrate dashboardpage
dekkerglen Oct 13, 2024
4dc021c
migrate devblog page
dekkerglen Oct 13, 2024
78b947a
migrate donate page
dekkerglen Oct 13, 2024
21c7b9b
migrate downtime page
dekkerglen Oct 13, 2024
54aa460
migrate edit podcast and edit video pages
dekkerglen Oct 14, 2024
0d100e5
Migrate Error page
dekkerglen Oct 14, 2024
ec8bd40
migrate explore page
dekkerglen Oct 14, 2024
964b9c9
migrate featured cubes page
dekkerglen Oct 14, 2024
f186854
migrate filters page
dekkerglen Oct 14, 2024
6c264be
Merge branch 'master' into tailwindcss
dekkerglen Oct 14, 2024
e2d9ebd
update deps, CreateCubeModal
dvndrsn Oct 14, 2024
dd88561
beautify
dvndrsn Oct 14, 2024
6cbc5a4
fix cube preview image centering
dvndrsn Oct 14, 2024
4ea057f
Merge pull request #2470 from dvndrsn/tailwindcss
dekkerglen Oct 14, 2024
f2c52c8
migrate cube overviewpage
dekkerglen Oct 15, 2024
2902fd5
migrate all headers to Text
dekkerglen Oct 15, 2024
6e44c1b
migrate cube overview modal
dekkerglen Oct 15, 2024
c3a59da
cache image route
dekkerglen Oct 15, 2024
b700699
migrate a few modals
dekkerglen Oct 31, 2024
d249bbf
Fix typo with double &&
KaelenProctor Oct 31, 2024
069c711
Quality of life change so tailwind CSS watch works when no standard in,
KaelenProctor Oct 31, 2024
501b5ad
Import Text component in JS files missing it
KaelenProctor Oct 31, 2024
137ee16
Fix #1770 by setting color-scheme in dark mode
KaelenProctor Oct 31, 2024
7235f0d
Merge pull request #2475 from KaelenProctor/feature/tailwindcss-1770
dekkerglen Nov 30, 2024
f6880ad
Work on deck page
dekkerglen Dec 7, 2024
3818e7f
Merge branch 'tailwindcss' of https://github.com/dekkerglen/CubeCobra…
dekkerglen Dec 8, 2024
7b5b5d9
migrate decks page
dekkerglen Dec 8, 2024
c718ad0
polish pick by pick breakdown
dekkerglen Dec 8, 2024
ffd1897
finish deck page
dekkerglen Dec 9, 2024
8e2cd93
remove cube decks page, move it inside of playtest tab instead
dekkerglen Dec 9, 2024
2cd012c
polish cube playtest page
dekkerglen Dec 9, 2024
2cf6287
work on cube draft
dekkerglen Dec 10, 2024
e849518
Migrate draft page
dekkerglen Dec 11, 2024
03e32d0
finish cube history page
dekkerglen Dec 11, 2024
3dd6f23
migrate info page
dekkerglen Dec 11, 2024
8bb0035
migrate loginpage
dekkerglen Dec 11, 2024
41af19f
migrate lostpassword page
dekkerglen Dec 11, 2024
280ba66
migrate markdown page
dekkerglen Dec 12, 2024
2e29b75
migrate notifications page
dekkerglen Dec 12, 2024
61ddb33
migrate package page
dekkerglen Dec 12, 2024
7b4074f
migrate password reset page
dekkerglen Dec 12, 2024
49eb8b6
migrate podcastspage
dekkerglen Dec 12, 2024
bd966fd
migrate recent drafts
dekkerglen Dec 12, 2024
222a108
migrate cube search page
dekkerglen Dec 12, 2024
caa6ed0
migrate user account page
dekkerglen Dec 12, 2024
d198088
migrate user pages
dekkerglen Dec 12, 2024
01c91f2
migrate social page
dekkerglen Dec 12, 2024
1ce1f66
dedupe indefinite pagination logic
dekkerglen Dec 12, 2024
28a9bb8
migrate grid draft page
dekkerglen Dec 12, 2024
7c176f1
migrate top cards
dekkerglen Dec 13, 2024
e0fb9bf
remove misc uses of reactstrap
dekkerglen Dec 13, 2024
eb8524e
remove remaining reactstrap
dekkerglen Dec 13, 2024
7f5e678
fix table view
dekkerglen Dec 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,4 @@ Card filters are defined that can be used by the frontend and backend. [Nearley]

### Components & Styling

Components are provided by [Reactstrap 9][reactstrap] which is powered by [Bootstrap v5.1][boostrap], which uses SCSS.

Components typically directly use bootstrap classes for additional styling, but may also use global classnames defined in public CSS files.

[reactstrap]: https://reactstrap.github.io/
[bootstrap]: https://getbootstrap.com/docs/5.1/getting-started/introduction/
Components are styled using TailwindCSS, with some custom CSS for more complex components.
3 changes: 2 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const { updateCardbase } = require('./serverjs/updatecards');
const carddb = require('./serverjs/carddb');
const { render } = require('./serverjs/render');
const { setup } = require('./serverjs/socketio');
const flash = require('connect-flash');

// global listeners for promise rejections
process.on('unhandledRejection', (reason) => {
Expand Down Expand Up @@ -103,7 +104,7 @@ app.use(
);

// Express messages middleware
app.use(require('connect-flash')());
app.use(flash());

app.use((req, res, next) => {
res.locals.messages = require('express-messages')(req, res);
Expand Down
11 changes: 11 additions & 0 deletions dynamo/models/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,16 @@ module.exports = {
},
];
},

scan: async (lastKey) => {
const result = await client.scan({
ExclusiveStartKey: lastKey,
ScanIndexForward: true,
});
return {
items: result.Items,
lastKey: result.LastEvaluatedKey,
};
},
FIELDS,
};
8 changes: 4 additions & 4 deletions dynamo/models/cube.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const FIELDS = {
OWNER: 'owner',
NAME: 'name',
VISIBILITY: 'visibility',
PRICE_VISIBLITY: 'priceVisibility',
PRICE_VISIBILITY: 'priceVisibility',
FEATURED: 'featured',
CATEGORY_OVERRIDE: 'categoryOverride',
CATEGORY_PREFIXES: 'categoryPrefixes',
Expand Down Expand Up @@ -57,7 +57,7 @@ const VISIBILITY = {
UNLISTED: 'un',
};

const PRICE_VISIBLITY = {
const PRICE_VISIBILITY = {
PUBLIC: 'pu',
PRIVATE: 'pr',
};
Expand Down Expand Up @@ -377,7 +377,7 @@ module.exports = {
[FIELDS.SHORT_ID]: cube.shortID,
[FIELDS.OWNER]: `${cube.owner}`,
[FIELDS.VISIBILITY]: getVisibility(cube.isListed, cube.isPrivate),
[FIELDS.PRICE_VISIBLITY]: cube.privatePrices ? PRICE_VISIBLITY.PRIVATE : PRICE_VISIBLITY.PUBLIC,
[FIELDS.PRICE_VISIBILITY]: cube.privatePrices ? PRICE_VISIBILITY.PRIVATE : PRICE_VISIBILITY.PUBLIC,
[FIELDS.FEATURED]: cube.isFeatured,
[FIELDS.CATEGORY_OVERRIDE]: cube.overrideCategory ? cube.categoryOverride : null,
[FIELDS.CATEGORY_PREFIXES]: cube.overrideCategory ? cube.categoryPrefixes : null,
Expand Down Expand Up @@ -448,6 +448,6 @@ module.exports = {
};
},
VISIBILITY,
PRICE_VISIBLITY,
PRICE_VISIBILITY,
FIELDS,
};
4 changes: 2 additions & 2 deletions dynamo/models/draft.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ module.exports = {
}),
);

initialState = draft.initial_state.map((seat) =>
initialState = draft.InitialState.map((seat) =>
seat.map((pack) => {
if (pack.cards) {
return {
Expand All @@ -555,7 +555,7 @@ module.exports = {
pickorders = draft.seats.map((seat) => seat.pickorder);

cards = draft.cards;
initialState = draft.initial_state.map((pack) =>
initialState = draft.InitialState.map((pack) =>
pack.map((idx) => cards.findIndex((card) => draft.cards[idx].cardID === card.cardID)),
);
} else {
Expand Down
3 changes: 2 additions & 1 deletion dynamo/models/featuredQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
[FIELDS.STATUS]: STATUS.ACTIVE,
});
},
querySortedByDate: async (lastKey) => {
querySortedByDate: async (lastKey, limit = 36) => {
const query = {
IndexName: 'ByDate',
KeyConditionExpression: '#status = :status',
Expand All @@ -52,6 +52,7 @@ module.exports = {
ExpressionAttributeValues: {
':status': STATUS.ACTIVE,
},
Limit: limit,
};
if (lastKey) {
query.ExclusiveStartKey = lastKey;
Expand Down
72 changes: 47 additions & 25 deletions dynamo/models/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@ const hydrate = async (pack) => {

pack.owner = await User.getById(pack.owner);
pack.cards = pack.cards.map((c) => {
if (c.id) {
if (c.scryfall_id) {
return c;
}
if (c.oracle_id) {
return carddb.cardFromId(carddb.oracleToId[c.oracle_id][0]);
}
return carddb.cardFromId(c);
});

Expand All @@ -75,12 +72,9 @@ const batchHydrate = async (packs) => {
packs.forEach((pack) => {
pack.owner = owners.find((owner) => owner.id === pack.owner);
pack.cards = pack.cards.map((c) => {
if (c.id) {
if (c.scryfall_id) {
return c;
}
if (c.oracle_id) {
return carddb.cardFromId(carddb.oracleToId[c.oracle_id][0]);
}
return carddb.cardFromId(c);
});
});
Expand All @@ -99,12 +93,8 @@ module.exports = {

if (document.cards) {
document.cards = document.cards.map((card) => {
if (card.id) {
return card.id;
}

if (carddb.oracle_id) {
return carddb.oracleToId[carddb.oracle_id][0];
if (card.scryfall_id) {
return card.scryfall_id;
}

return card;
Expand Down Expand Up @@ -136,15 +126,31 @@ module.exports = {
},
ScanIndexForward: ascending,
ExclusiveStartKey: lastKey,
Limit: 10,
limit: 36,
};

const result = await client.query(query);


if (keywords) {
result.Items = result.Items.filter((item) => item[FIELDS.KEYWORDS].some((keyword) => keywords.includes(keyword)));
const words = keywords ? keywords.toLowerCase().split(' ') : null;

// all words must exist in the keywords
query.FilterExpression = words.map((word) => `contains(#keywords, :${word})`).join(' and ');

query.ExpressionAttributeNames = {
...query.ExpressionAttributeNames,
'#keywords': FIELDS.KEYWORDS,
};

query.ExpressionAttributeValues = {
...query.ExpressionAttributeValues,
...words.reduce((acc, word) => {
acc[`:${word}`] = word;
return acc;
}, {}),
};
}

const result = await client.query(query);

return {
items: await batchHydrate(result.Items),
lastKey: result.LastEvaluatedKey,
Expand All @@ -162,15 +168,31 @@ module.exports = {
},
ScanIndexForward: ascending,
ExclusiveStartKey: lastKey,
Limit: 10,
limit: 36,
};

const result = await client.query(query);

if (keywords && keywords.length > 0) {
result.Items = result.Items.filter((item) => item[FIELDS.KEYWORDS].some((keyword) => keywords.includes(keyword)));
if (keywords) {
const words = keywords ? keywords.toLowerCase().split(' ') : null;

// all words must exist in the keywords
query.FilterExpression = words.map((word) => `contains(#keywords, :${word})`).join(' and ');

query.ExpressionAttributeNames = {
...query.ExpressionAttributeNames,
'#keywords': FIELDS.KEYWORDS,
};

query.ExpressionAttributeValues = {
...query.ExpressionAttributeValues,
...words.reduce((acc, word) => {
acc[`:${word}`] = word;
return acc;
}, {}),
};
}

const result = await client.query(query);

return {
items: await batchHydrate(result.Items),
lastKey: result.LastEvaluatedKey,
Expand All @@ -187,7 +209,7 @@ module.exports = {
':owner': owner,
},
ExclusiveStartKey: lastKey,
limit: 10,
limit: 100,
};

const result = await client.query(query);
Expand Down
2 changes: 2 additions & 0 deletions dynamo/models/user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { getImageData } = require('../../serverjs/util');
const createClient = require('../util');
const { deleteById } = require('./cube');

const FIELDS = {
ID: 'id',
Expand Down Expand Up @@ -171,6 +172,7 @@ module.exports = {
},
batchGet: async (ids) => batchHydrate(batchStripSensitiveData(await client.batchGet(ids.map((id) => `${id}`)))),
createTable: async () => client.createTable(),
deleteById: async (id) => client.delete({id}),
convertUser: (user) => ({
[FIELDS.ID]: `${user._id}`,
[FIELDS.USERNAME]: user.username,
Expand Down
4 changes: 2 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export default [
groups: [
// Node.js builtins prefixed with `node:`.
['^node:'],
// react and reactstrap.
['^react$', '^reactstrap$'],
// react .
['^react$'],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
['^@?\\w'],
Expand Down
Loading
Loading