Skip to content

Commit 486d78b

Browse files
committed
Merge branch 'main' into feature/login-by-email
2 parents 8a3d28c + 089f533 commit 486d78b

File tree

18 files changed

+185
-51
lines changed

18 files changed

+185
-51
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Hello! We're glad to have you interested in contributing to Note Block World. This document will guide you through the process of setting up the project and submitting your contributions.
44

5-
This page is a work-in-progress and will be updated as the project evolves. If you have any questions or need help, feel free to reach out to us on our [Discord server](https://discord.gg/open-note-block-studio-608692895179997252).
5+
This page is a work-in-progress and will be updated as the project evolves. If you have any questions or need help, feel free to reach out to us on our [Discord server](https://discord.gg/note-block-world-608692895179997252).
66

77
## Stack
88

server/src/song/song.controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ export class SongController {
122122
@GetRequestToken() user: UserDocument | null,
123123
@Res() res: Response,
124124
): Promise<void> {
125+
user = validateUser(user);
126+
125127
// TODO: no longer used
126128
res.set({
127129
'Content-Disposition': 'attachment; filename="song.nbs"',

shared/features/song/obfuscate.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,21 @@ export class SongObfuscator {
119119

120120
const resolveKeyAndPitch = (note: Note) => {
121121
const factoredPitch = note.key * 100 + note.pitch;
122-
const key = Math.floor((factoredPitch + 50) / 100);
123-
const pitch = ((factoredPitch + 50) % 100) - 50;
122+
123+
let key, pitch;
124+
125+
if (factoredPitch < 0) {
126+
// Below A0
127+
key = 0;
128+
pitch = factoredPitch;
129+
} else if (factoredPitch >= 87 * 100) {
130+
// Above C8
131+
key = 87;
132+
pitch = factoredPitch - 87 * 100;
133+
} else {
134+
key = Math.floor((factoredPitch + 50) / 100);
135+
pitch = ((factoredPitch + 50) % 100) - 50;
136+
}
124137

125138
return { key, pitch };
126139
};

shared/validation/song/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ export const MY_SONGS = deepFreeze({
128128
});
129129

130130
export const BROWSER_SONGS = deepFreeze({
131-
max_recent_songs: 100,
132131
featuredPageSize: 10,
133132
paddedFeaturedPageSize: 5,
134133
});

web/src/app/(content)/(info)/contact/contact.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ Have you got any question, suggestion or feedback? We'd love to hear from you!
22

33
To report an issue or suggest a new feature, please [open a new issue](https://github.com/issues/new/choose) in our GitHub repository. Make sure to search the existing issues to see if your suggestion has already been made. Also, check our [project roadmap](https://github.com/orgs/OpenNBS/projects/4) to see if the feature you want is already planned!
44

5-
For general support, or if you'd just like to have a chat, the fastest way to get in touch with us is by joining our public community on [Discord](https://discord.gg/open-note-block-studio-608692895179997252). We're always happy to help!
5+
For general support, or if you'd just like to have a chat, the fastest way to get in touch with us is by joining our public community on [Discord](https://discord.gg/note-block-world-608692895179997252). We're always happy to help!
66

77
For business inquiries, or if you need to reach out to us privately, you can send us an email at [[email protected]]([email protected]).

web/src/app/(content)/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ export const metadata: Metadata = {
5252
};
5353

5454
async function Home() {
55-
const recentSongs = await fetchRecentSongs();
55+
//const recentSongs = await fetchRecentSongs();
5656
const featuredSongs = await fetchFeaturedSongs();
5757

5858
return (
5959
<HomePageProvider
60-
initialRecentSongs={recentSongs}
60+
initialRecentSongs={[]}
6161
initialFeaturedSongs={featuredSongs}
6262
>
6363
<HomePageComponent />

web/src/modules/browse/WelcomeBanner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const WelcomeBanner = () => {
4040
</Link>
4141
{' • '}
4242
<Link
43-
href='https://github.com/OpenNBS/NoteBlockWorld/issues/new/choose'
43+
href='https://discord.gg/note-block-world-608692895179997252'
4444
className='text-blue-400 hover:text-blue-300'
4545
>
4646
Discord Server

web/src/modules/browse/components/client/context/RecentSongs.context.tsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use client';
22

3-
import { BROWSER_SONGS } from '@shared/validation/song/constants';
43
import { SongPreviewDtoType } from '@shared/validation/song/dto/types';
54
import {
65
createContext,
@@ -39,7 +38,7 @@ export function RecentSongsProvider({
3938
useState<SongPreviewDtoType[]>(initialRecentSongs);
4039

4140
const [recentError, setRecentError] = useState<string>('');
42-
const [page, setPage] = useState<number>(3);
41+
const [page, setPage] = useState<number>(0);
4342
const [loading, setLoading] = useState(false);
4443
const [hasMore, setHasMore] = useState(true);
4544
const [categories, setCategories] = useState<Record<string, number>>({});
@@ -56,7 +55,7 @@ export function RecentSongsProvider({
5655
{
5756
params: {
5857
page,
59-
limit: 8, // TODO: fix constants
58+
limit: 12, // TODO: fix constants
6059
order: false,
6160
},
6261
},
@@ -67,7 +66,7 @@ export function RecentSongsProvider({
6766
...response.data,
6867
]);
6968

70-
if (response.data.length < 8) {
69+
if (response.data.length < 12) {
7170
setHasMore(false);
7271
}
7372
} catch (error) {
@@ -114,18 +113,13 @@ export function RecentSongsProvider({
114113
setEndpoint(newEndpoint);
115114
}, [selectedCategory]);
116115

117-
// Fetch recent songs when the page or endpoint changes
118116
useEffect(() => {
117+
if (page === 0) return;
119118
fetchRecentSongs();
120-
}, [page, endpoint]);
119+
}, [page, endpoint, fetchRecentSongs]);
121120

122121
async function increasePageRecent() {
123-
if (
124-
BROWSER_SONGS.max_recent_songs <= recentSongs.length ||
125-
loading ||
126-
recentError ||
127-
!hasMore
128-
) {
122+
if (loading || recentError || !hasMore) {
129123
return;
130124
}
131125

web/src/modules/shared/components/client/ads/AdSlots.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ const AdTemplate = ({
3939
adFormat = 'auto',
4040
fullWidthResponsive = 'true',
4141
hiddenClassName = 'hidden',
42+
showCloseButton = true,
4243
}: {
4344
className: string;
4445
adSlot: string;
4546
adFormat: string;
4647
fullWidthResponsive: string;
4748
hiddenClassName?: string;
49+
showCloseButton?: boolean;
4850
}) => {
4951
const pubId = useAdSenseClient();
5052

@@ -81,7 +83,7 @@ const AdTemplate = ({
8183
data-ad-format={adFormat}
8284
data-full-width-responsive={fullWidthResponsive}
8385
></ins>
84-
<HideAdButton setIsHidden={setIsHidden} />
86+
{showCloseButton && <HideAdButton setIsHidden={setIsHidden} />}
8587
</>
8688
)}
8789
</div>
@@ -122,3 +124,18 @@ export const SideRailAdSlot = ({ className }: { className?: string }) => {
122124
/>
123125
);
124126
};
127+
128+
export const DownloadPopupAdSlot = ({ className }: { className?: string }) => {
129+
return (
130+
<AdTemplate
131+
className={cn(
132+
'relative rounded-xl bg-zinc-800/50 p-2 my-8 h-32 max-h-32 w-full min-w-64 text-sm text-zinc-400',
133+
className,
134+
)}
135+
adSlot='3239923384'
136+
adFormat='auto'
137+
fullWidthResponsive='true'
138+
showCloseButton={false}
139+
/>
140+
);
141+
};

web/src/modules/shared/components/layout/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function Footer() {
2929
<FooterIcon icon={faGithub} href='https://github.com/OpenNBS' />
3030
<FooterIcon
3131
icon={faDiscord}
32-
href='https://discord.gg/open-note-block-studio-608692895179997252'
32+
href='https://discord.gg/note-block-world-608692895179997252'
3333
/>
3434
{/* <FooterIcon icon={faEarth} href='https://opennbs.org' /> */}
3535
{/* <FooterIcon icon={faEnvelope} href='mailto:[email protected]' /> */}

0 commit comments

Comments
 (0)