Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
28 changes: 14 additions & 14 deletions NoteBlockWorld.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@
"folders": [
{
"path": ".",
"name": "Root",
"name": "Root"
},
{
"path": "./apps/backend",
"name": "Backend",
"name": "Backend"
},
{
"path": "./apps/frontend",
"name": "Frontend",
"name": "Frontend"
},
{
"path": "./packages/configs",
"name": "configs",
"name": "configs"
},
{
"path": "./packages/database",
"name": "database",
"name": "database"
},
{
"path": "./packages/song",
"name": "song",
"name": "song"
},
{
"path": "./packages/sounds",
"name": "sounds",
"name": "sounds"
},
{
"path": "./packages/thumbnail",
"name": "thumbnail",
},
"name": "thumbnail"
}
],
"settings": {
"window.title": "${dirty}${rootName}${separator}${profileName}${separator}${appName}",
Expand All @@ -41,12 +41,12 @@
"eslint.format.enable": true,
"mdx.server.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.fixAll": "explicit"
},
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/dist": true,
"**/dist": true
},
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#fac977",
Expand All @@ -65,8 +65,8 @@
"titleBar.activeBackground": "#f8b646",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#f8b64699",
"titleBar.inactiveForeground": "#15202b99",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#f8b646",
},
"peacock.color": "#f8b646"
}
}
6 changes: 5 additions & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"@nbw/database": "workspace:*",
"@nbw/song": "workspace:*",
"@nbw/thumbnail": "workspace:*",
"@nbw/sounds": "workspace:*"
"@nbw/sounds": "workspace:*",
"@nbw/config": "workspace:*"
},
"devDependencies": {
"@faker-js/faker": "^9.3.0",
Expand All @@ -70,6 +71,7 @@
"@types/bcryptjs": "^2.4.6",
"@types/bun": "^1.2.10",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/multer": "^1.4.12",
"@types/node": "^20.17.10",
"@types/passport": "^1.0.17",
Expand All @@ -79,8 +81,10 @@
"@types/passport-local": "^1.0.38",
"@types/passport-oauth2": "^1.4.17",
"@types/supertest": "^2.0.16",
"jest": "^29.7.0",
"source-map-support": "^0.5.21",
"supertest": "^6.3.4",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsc-watch": "^6.2.1",
Expand Down
5 changes: 3 additions & 2 deletions apps/backend/src/song-browser/song-browser.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ export class SongBrowserService {
) {
const missing = BROWSER_SONGS.paddedFeaturedPageSize - songPage.length;

const additionalSongs =
await this.songService.getSongsBeforeTimespan(time);
const additionalSongs = await this.songService.getSongsBeforeTimespan(
time,
);

songPage.push(...additionalSongs.slice(0, missing));
}
Expand Down
25 changes: 12 additions & 13 deletions apps/backend/src/song/song.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ export class SongService {
'username profileImage -_id',
)) as unknown as SongWithUser;

const webhookMessageId =
await this.songWebhookService.syncSongWebhook(populatedSong);
const webhookMessageId = await this.songWebhookService.syncSongWebhook(
populatedSong,
);

songDocument.webhookMessageId = webhookMessageId;

Expand Down Expand Up @@ -170,8 +171,9 @@ export class SongService {
'username profileImage -_id',
)) as unknown as SongWithUser;

const webhookMessageId =
await this.songWebhookService.syncSongWebhook(populatedSong);
const webhookMessageId = await this.songWebhookService.syncSongWebhook(
populatedSong,
);

foundSong.webhookMessageId = webhookMessageId;

Expand Down Expand Up @@ -418,16 +420,13 @@ export class SongService {
])) as unknown as { _id: string; count: number }[];

// Return object with category names as keys and counts as values
return categories.reduce(
(acc, category) => {
if (category._id) {
acc[category._id] = category.count;
}
return categories.reduce((acc, category) => {
if (category._id) {
acc[category._id] = category.count;
}

return acc;
},
{} as Record<string, number>,
);
return acc;
}, {} as Record<string, number>);
}

public async getSongsByCategory(
Expand Down
67 changes: 35 additions & 32 deletions apps/backend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
// NestJS specific settings
"module": "commonjs",
"target": "ES2021",
"declaration": true,
"removeComments": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
// Relaxed strict settings for backend
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,
// Path mapping
"paths": {
"@server/*": ["src/*"]
}
},
"include": ["src/**/*.ts"],
"exclude": [
"node_modules",
"dist",
"**/*.spec.ts",
"**/*.test.ts",
"e2e/**/*",
"test/**/*"
]
}
"extends": "../../tsconfig.base.json",
"compilerOptions": {
// NestJS specific settings
"module": "commonjs",
"target": "ES2021",
"declaration": true,
"removeComments": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
// Relaxed strict settings for backend
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,
// Path mapping
"paths": {
"@server/*": [
"src/*"
]
}
},
"include": [
"src/**/*.ts",
"src/**/*.d.ts"
],
"exclude": [
"node_modules",
"dist",
"e2e/**/*",
"test/**/*"
]
}
1 change: 1 addition & 0 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@hookform/resolvers": "^3.3.4",
"@mdx-js/loader": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@nbw/database": "workspace:*",
"@next/mdx": "^14.2.6",
"@next/third-parties": "^14.2.5",
"@radix-ui/react-dialog": "^1.0.5",
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/posts/blog/2024-10-07_changelog-october-2024.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Here's what we've been up to since the last update:
- The idea is to host guest writers from the community once in a while, so stay tuned!
- Added the _About_ page! We're proud of our history and want to share it with you. We also want to acknowledge all the great people that have made this website possible, and everyone who's helped us along the way. Make sure to drop by and read about how Note Block World came to be!
- The navigation bar at the top has been redesigned:

- Now features _Songs_, _Help_, _Blog_, and _About_ tabs.
- The _Upload_ icon is no longer shown on mobile devices.
- The external links (_GitHub_, _Changelog_, and _Donate_) have been moved from inside your user menu into a 'Settings' menu, so they're now accessible even if you aren't logged in.
Expand All @@ -31,6 +32,7 @@ Here's what we've been up to since the last update:
### Bugfixes and improvements

- Added more mob sounds to the available custom instruments:

- Polar Bear
- Phantom
- Evoker
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/posts/help/1_creating-song.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Once you've made a selection, you can:
Selecting notes also lets you change them in other ways, all of which are available in the context menu that appears when you right-click the workspace, or by using the keyboard shortcuts below:

- **Transpose**: You can transpose the selected notes up or down by a certain number of semitones. This is useful for changing the key of a section of the song, or for creating harmonies.

- **Transpose up** (`Ctrl+R`): Transpose the selected notes up by one semitone.
- **Transpose down** (`Ctrl+F`): Transpose the selected notes down by one semitone.
- **Transpose one octave up**: Transpose the selected notes up by one octave (12 semitones).
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/posts/help/5_custom-instruments.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ You've added a custom instrument to your song! You can now use it just like any
There are a few limitations to keep in mind when working with custom instruments in Note Block Studio:

- **Custom instruments are not saved with the song file**: Song files only store the custom instrument settings, not the sound files themselves. This means that if you share your song with someone else, they won't have access to your custom instruments unless you also share the sound files you used. There are two ways to work around this limitation:

- **Share the sound files** along with the song file, so others can use the custom instruments in your song. You can save the song in a ZIP file that includes the sound files you used by going to _File_ > _Save song with custom sounds..._. Alternatively, you can save only the instruments to a ZIP file by going to _Settings_ > _Instrument settings..._ and clicking _Export sounds_.
- **Use the same sound files** for custom instruments in all your songs, so you don't have to share them every time you share a song. In the section _Downloading songs that use custom instruments_ further down this article, you'll learn how to obtain Minecraft sound files that you can use to standardize the reference to your custom sound files.

Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/src/app/(content)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Metadata } from 'next';

import { FeaturedSongsDtoType, SongPreviewDtoType } from '@nbw/database';
import type { FeaturedSongsDto, SongPreviewDto } from '@nbw/database';
import axiosInstance from '@web/lib/axios';
import { HomePageProvider } from '@web/modules/browse/components/client/context/HomePage.context';
import { HomePageComponent } from '@web/modules/browse/components/HomePageComponent';

async function fetchRecentSongs() {
try {
const response = await axiosInstance.get<SongPreviewDtoType[]>(
const response = await axiosInstance.get<SongPreviewDto[]>(
'/song-browser/recent',
{
params: {
Expand All @@ -25,9 +25,9 @@ async function fetchRecentSongs() {
}
}

async function fetchFeaturedSongs(): Promise<FeaturedSongsDtoType> {
async function fetchFeaturedSongs(): Promise<FeaturedSongsDto> {
try {
const response = await axiosInstance.get<FeaturedSongsDtoType>(
const response = await axiosInstance.get<FeaturedSongsDto>(
'/song-browser/featured',
);

Expand Down
30 changes: 12 additions & 18 deletions apps/frontend/src/lib/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,21 @@ export type PostType = {

const blogPostIds = fs
.readdirSync(path.join(process.cwd(), 'posts', 'blog'))
.reduce(
(acc, fileName) => {
// Remove ".md" and date prefix to get post ID
const postId = fileName.replace(/\.md$/, '').split('_')[1];
acc[postId] = fileName;
return acc;
},
{} as Record<string, string>,
);
.reduce((acc, fileName) => {
// Remove ".md" and date prefix to get post ID
const postId = fileName.replace(/\.md$/, '').split('_')[1];
acc[postId] = fileName;
return acc;
}, {} as Record<string, string>);

const helpPostIds = fs
.readdirSync(path.join(process.cwd(), 'posts', 'help'))
.reduce(
(acc, fileName) => {
// Remove ".md" and number prefix to get help article ID
const helpId = fileName.replace(/\.md$/, '').split('_')[1];
acc[helpId] = fileName;
return acc;
},
{} as Record<string, string>,
);
.reduce((acc, fileName) => {
// Remove ".md" and number prefix to get help article ID
const helpId = fileName.replace(/\.md$/, '').split('_')[1];
acc[helpId] = fileName;
return acc;
}, {} as Record<string, string>);

export function getSortedPostsData(
postsPath: 'help' | 'blog',
Expand Down
Loading