Skip to content

Feature/iw 23 search engine for song search implementation#6

Closed
Vemtor wants to merge 11 commits intodevelopfrom
feature/IW-23-search-engine-for-song-search-implementation
Closed

Feature/iw 23 search engine for song search implementation#6
Vemtor wants to merge 11 commits intodevelopfrom
feature/IW-23-search-engine-for-song-search-implementation

Conversation

@Vemtor
Copy link
Owner

@Vemtor Vemtor commented May 4, 2025

Search Engine is now working. Currently (because our app's layouts are not coded yet) I added the search layout into default welcome page. Run the app and at the bottom of the screen tap search button to move to search engine tab

@Vemtor Vemtor requested review from ariemic and removed request for ariemic May 4, 2025 15:23
@Vemtor Vemtor requested a review from ariemic May 5, 2025 17:13
Copy link
Collaborator

@ariemic ariemic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everthing works just fine.

@ariemic ariemic closed this May 5, 2025
@ariemic ariemic reopened this May 5, 2025
Copy link
Collaborator

@Galaktikkon Galaktikkon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the liberty of getting a peek at the code. It's good in most parts. Pull changes from develop and apply Figma design. Some conventions:

  • for files and directories use kebab-case
  • for component names use PascalCase
  • when defining widely used types/interfaces, place those into dedicated types directory

Also, remove any logs. If fetching produces any error the user should be notified.

Please fix the API key placement!

Comment on lines 1 to 24
export class SearchedVideo {
id: string;
title: string;
description: string;
thumbnailUrl: string;
channelTitle: string;
publishedAt: string;

constructor(
id: string,
title: string,
description: string,
thumbnailUrl: string,
channelTitle: string,
publishedAt: string,
) {
this.id = id;
this.title = title;
this.description = description;
this.thumbnailUrl = thumbnailUrl;
this.channelTitle = channelTitle;
this.publishedAt = publishedAt;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may well be a plain js object with proper typing. I guess it's some java influence there 😄

items: YouTubeSearchItem[];
}

export interface YouTubeSearchItem {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation

setVideos([]);
setLoading(true);
try {
const apiKey = 'AIzaSyAcyaA3htasw-LLJQwBJvZzCbM2o6stE4s';
Copy link
Collaborator

@Galaktikkon Galaktikkon May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's safe to do sth like this...

fetchData();
}, [debouncedSearch]);

const styles = StyleSheet.create({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could move these to the bottom of the file as they are not the most important structure when glancing components.

Comment on lines 1 to 16
import { SearchedVideo } from './searchedVideo'
import { YouTubeSearchItem } from './youtubeSearchResponse'

export const mapToSearchedVideo = (data: YouTubeSearchItem): SearchedVideo[] => {
return data.items.map(
(item) =>
new SearchedVideo(
item.id.videoId,
item.snippet.title,
item.snippet.description,
item.snippet.thumbnails.medium.url,
item.snippet.channelTitle,
item.snippet.publishedAt
)
)
} No newline at end of file
Copy link
Collaborator

@Galaktikkon Galaktikkon May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is necessary at all. I'm certain there is a cleaner way to do this. Extracting just this part of the logic is not really good IMO. Also, this should be in utils directory if anything.

@Vemtor Vemtor requested a review from Galaktikkon May 8, 2025 18:32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is way too big. Segment the code into smaller pieces.

  • not every function/variable needs to be declared inside the component's body as it affects performance
  • declare styles at the end of the file
  • is colors basically the colors.ts file? You can import colors from there as those reflect figma's color pallete (if something is missing please add it to the file), it is located in constants directory
  • you can check typography.ts too
  • remove apiKey from commit history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants