From 6eca728a9b71d86b3197e2597c3d32723eac46fb Mon Sep 17 00:00:00 2001 From: Kristen Liu Date: Sat, 30 Nov 2024 00:06:58 -0500 Subject: [PATCH 1/2] adding more communities --- server/data/posts_strings.ts | 83 +++++++++++++- server/populate_db.ts | 203 ++++++++++++++++++++++++++++++++--- 2 files changed, 270 insertions(+), 16 deletions(-) diff --git a/server/data/posts_strings.ts b/server/data/posts_strings.ts index 2d96919..98995f0 100644 --- a/server/data/posts_strings.ts +++ b/server/data/posts_strings.ts @@ -15,6 +15,45 @@ export const Q4_DESC = 'Quick question about storage on android'; export const Q4_TXT = 'I would like to know the best way to go about storing an array on an android phone so that even when the app/activity ended the data remains'; +export const Q5_DESC = 'Question about Mongodb'; +export const Q5_TXT = 'What is the best way to store large amounts of data in a MongoDB database?'; + +export const Q6_DESC = 'Question about training a Machine Learning model'; +export const Q6_TXT = + 'I am trying to train a machine learning logsitic regression model, however I am getting a log loss error while training the model. What might be causing this?'; + +export const Q7_DESC = 'Question about NLP'; +export const Q7_TXT = + 'Im currently working on a project that uses natural language processing. I am looking for suggestions on the best libraries and tools to use for this.'; + +export const Q8_DESC = 'Question about encryption'; +export const Q8_TXT = + 'I am looking to encrypt some data in my application. What is the best way to go about this?'; + +export const Q9_DESC = 'Writing unit tests'; +export const Q9_TXT = + 'How do I write unit tests for my application? I am looking for suggestions on the best practices for writing them.'; + +export const Q10_DESC = 'Data pipeline architecture and optimization'; +export const Q10_TXT = + 'I am looking to build a data pipeline for my application. What is the best way to go about this to optimize the pipeline for high performance?'; + +export const Q11_DESC = 'Question about AWS'; +export const Q11_TXT = + 'I am looking to deploy my application on AWS. What are the best practices for deploying an application on AWS?'; + +export const Q12_DESC = 'Question about CSS for styling webpage'; +export const Q12_TXT = + 'How can I center a div both vertically and horizontally using Flexbox in CSS?'; + +export const Q13_DESC = 'Reusable components in Figma'; +export const Q13_TXT = + 'Am I able to create a reusable component in Figma and share it across multiple projects/files?'; + +export const Q14_DESC = 'Data visualization libraries'; +export const Q14_TXT = + 'What are the best data visualization libraries available for creating interactive charts and graphs?'; + export const A1_TXT = "React Router is mostly a wrapper around the history library. history handles interaction with the browser's window.history for you with its browser and hash histories. It also provides a memory history which is useful for environments that don't have a global history. This is particularly useful in mobile app development (react-native) and unit testing with Node."; export const A2_TXT = @@ -58,6 +97,39 @@ export const T7_DESC = export const T8_NAME = 'aws'; export const T8_DESC = 'Amazon Web Services (AWS) is a comprehensive, evolving cloud computing platform provided by Amazon. It offers a mix of infrastructure as a service (IaaS), platform as a service (PaaS), and packaged software as a service (SaaS) offerings.'; + +export const T9_NAME = 'mongodb'; +export const T9_DESC = + 'MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas.'; + +export const T10_NAME = 'machine-learning'; +export const T10_DESC = + 'Machine learning is an application of artificial intelligence that provides systems the ability to automatically learn and improve from experience without being explicitly programmed.'; + +export const T11_NAME = 'natural-language-processing'; +export const T11_DESC = + 'Natural language processing is a subfield of artificial intelligence that focuses on the interaction between computers and humans using natural language.'; + +export const T12_NAME = 'encryption'; +export const T12_DESC = + 'Encryption is the process of converting information into a code to prevent unauthorized access.'; + +export const T13_NAME = 'unit-testing'; +export const T13_DESC = + 'Unit testing is a software testing method where units of source code are tested to determine whether they are fit for use.'; + +export const T14_NAME = 'data-pipeline'; +export const T14_DESC = + 'A data pipeline is a series of data processing steps that are used to move data from one system to another.'; + +export const T15_NAME = 'figma'; +export const T15_DESC = + 'Figma is a cloud-based design tool used for creating user interfaces, prototypes, and collaborative design projects. It allows real-time collaboration, enabling multiple team members to work together on designs from anywhere.'; + +export const T16_NAME = 'data-visualization'; +export const T16_DESC = + 'Data visualization is the graphical representation of information and data. By using visual elements like charts, graphs, and maps, data visualization tools provide an accessible way to see and understand trends, outliers, and patterns in data.'; + export const C1_TEXT = 'This explanation about React Router is really helpful! I never realized it was just a wrapper around history. Thanks!'; export const C2_TEXT = @@ -83,7 +155,12 @@ export const C11_TEXT = export const C12_TEXT = "I feel like there's so much more to Android Studio that I'm just scratching the surface of. Thanks for sharing your experience!"; export const FRONT_END_TAGS = [T1_NAME, T6_NAME, T7_NAME]; -// export const BACK_END_TAGS = ['mongodb', 'node.js']; -// export const ML_TAGS = ['neural-networks', 'deep-learning']; -// export const AI_TAGS = ['neural-networks', 'reinforcement-learning', 'pytorch', 'nlp']; +export const BACK_END_TAGS = [T9_NAME]; +export const MOBILE_APP_TAGS = [T3_NAME, T4_NAME]; +export const AI_TAGS = [T10_NAME, T11_NAME]; +export const CYBER_TAGS = [T12_NAME]; +export const TESTING_TAGS = [T13_NAME]; +export const DATA_ENGINEERING_TAGS = [T14_NAME]; +export const DESIGN_TAGS = [T15_NAME]; +export const DS_TAGS = [T16_NAME]; export const CLOUD_TAGS = [T8_NAME, T5_NAME]; // ADD AZURE, GCP diff --git a/server/populate_db.ts b/server/populate_db.ts index b69f231..134a222 100644 --- a/server/populate_db.ts +++ b/server/populate_db.ts @@ -47,14 +47,55 @@ import { C11_TEXT, C12_TEXT, FRONT_END_TAGS, - // BACK_END_TAGS, - // ML_TAGS, - // AI_TAGS, CLOUD_TAGS, T7_NAME, T7_DESC, T8_NAME, T8_DESC, + T9_NAME, + T9_DESC, + Q5_DESC, + Q5_TXT, + BACK_END_TAGS, + MOBILE_APP_TAGS, + T10_NAME, + T10_DESC, + T11_NAME, + T11_DESC, + Q6_DESC, + Q6_TXT, + Q7_DESC, + Q7_TXT, + AI_TAGS, + T12_NAME, + T12_DESC, + Q8_DESC, + Q8_TXT, + CYBER_TAGS, + T13_NAME, + T13_DESC, + Q9_DESC, + Q9_TXT, + TESTING_TAGS, + T14_NAME, + T14_DESC, + Q10_DESC, + Q10_TXT, + DATA_ENGINEERING_TAGS, + Q11_DESC, + Q11_TXT, + Q12_DESC, + Q12_TXT, + T15_NAME, + T15_DESC, + Q13_DESC, + Q13_TXT, + DESIGN_TAGS, + T16_NAME, + T16_DESC, + Q14_DESC, + Q14_TXT, + DS_TAGS, } from './data/posts_strings'; import CommentModel from './models/comments'; @@ -244,6 +285,14 @@ const populate = async () => { const t6 = await tagCreate(T6_NAME, T6_DESC); const t7 = await tagCreate(T7_NAME, T7_DESC); const t8 = await tagCreate(T8_NAME, T8_DESC); + const t9 = await tagCreate(T9_NAME, T9_DESC); + const t10 = await tagCreate(T10_NAME, T10_DESC); + const t11 = await tagCreate(T11_NAME, T11_DESC); + const t12 = await tagCreate(T12_NAME, T12_DESC); + const t13 = await tagCreate(T13_NAME, T13_DESC); + const t14 = await tagCreate(T14_NAME, T14_DESC); + const t15 = await tagCreate(T15_NAME, T15_DESC); + const t16 = await tagCreate(T16_NAME, T16_DESC); const c1 = await commentCreate(C1_TEXT, 'sana', new Date('2023-12-12T03:30:00')); @@ -308,21 +357,149 @@ const populate = async () => { [], [c12], ); + await questionCreate( + Q5_DESC, + Q5_TXT, + [t9], + [], + 'tigerCDE', + new Date('2023-04-10T14:28:01'), + [], + [], + ); + await questionCreate( + Q6_DESC, + Q6_TXT, + [t10], + [], + 'elphie09', + new Date('2023-04-10T14:28:01'), + [], + [], + ); + await questionCreate( + Q7_DESC, + Q7_TXT, + [t11], + [], + 'glinda12', + new Date('2023-04-24T14:28:01'), + [], + [], + ); + await questionCreate( + Q8_DESC, + Q8_TXT, + [t12], + [], + 'wizzardOZ', + new Date('2023-05-12T14:28:01'), + [], + [], + ); + await questionCreate( + Q9_DESC, + Q9_TXT, + [t13], + [], + 'phiYero103', + new Date('2023-05-12T14:28:01'), + [], + [], + ); + await questionCreate( + Q10_DESC, + Q10_TXT, + [t14], + [], + 'snowFlake00', + new Date('2023-07-03T14:28:01'), + [], + [], + ); + await questionCreate( + Q11_DESC, + Q11_TXT, + [t8], + [], + 'christmasLuvr', + new Date('2023-02-03T14:12:01'), + [], + [], + ); + await questionCreate( + Q12_DESC, + Q12_TXT, + [t6, t7], + [], + 'teddyBear22', + new Date('2023-03-09T14:28:03'), + [], + [], + ); + await questionCreate( + Q13_DESC, + Q13_TXT, + [t15], + [], + 'penguin34', + new Date('2023-09-15T14:28:03'), + [], + [], + ); + await questionCreate( + Q14_DESC, + Q14_TXT, + [t16], + [], + 'iguanaXYZ', + new Date('2023-10-25T14:12:03'), + [], + [], + ); + + + // FRONT-END: react, website, css const frontEndQuestions = await getQuestionsByTags([t1, t6, t7]); - // const backEndQuestions = await getQuestionsByTags(BACK_END_TAGS); - // const machineLearningQuestions = await getQuestionsByTags(ML_TAGS); - // const aiQuestions = await getQuestionsByTags(AI_TAGS); - const cloudQuestions = await getQuestionsByTags([t5, t8]); - const community1 = await communityCreate('front-end-development', FRONT_END_TAGS, [], frontEndQuestions); - // await communityCreate('back-end-development', BACK_END_TAGS, [], backEndQuestions); - // await communityCreate('machine learning', ML_TAGS, [], machineLearningQuestions); - // await communityCreate('ai', AI_TAGS, [], aiQuestions); - const community2 = await communityCreate('cloud computing', CLOUD_TAGS, [], cloudQuestions); + // BACK-END: mongodb + const backEndQuestions = await getQuestionsByTags([t9]); + + // AI: machine-learning, natural-language-processing + const aiQuestions = await getQuestionsByTags([t10, t11]); - // await userCreate('user1', 'John', 'Doe', [t1, t2], community1, 'low'); + // MOBILE APP DEVELOPMENT: android-studio, shared-preferences, javascript + const mobileAppQuestions = await getQuestionsByTags([t2, t3, t4]); + + // CYBERSECURITY: encryption + const cyberQuestions = await getQuestionsByTags([t12]); + + // TESTING: unit-tests + const testingQuestions = await getQuestionsByTags([t13]); + + // DATA ENGINEERING: data-pipeline + const dataEngineeringQuestions = await getQuestionsByTags([t14]); + + // DESIGN: figma + const designQuestions = await getQuestionsByTags([t15]); + + // DS: data-visualization + const dsQuestions = await getQuestionsByTags([t16]); + + // CLOUD COMPUTING: aws, storage + const cloudQuestions = await getQuestionsByTags([t5, t8]); + await communityCreate('front-end-development', FRONT_END_TAGS, [], frontEndQuestions); + await communityCreate('back-end-development', BACK_END_TAGS, [], backEndQuestions); + await communityCreate('artificial intelligence', AI_TAGS, [], aiQuestions); + await communityCreate('mobile-app-development', MOBILE_APP_TAGS, [], mobileAppQuestions); + await communityCreate('cybersecurity', CYBER_TAGS, [], cyberQuestions); + await communityCreate('software testing', TESTING_TAGS, [], testingQuestions); + await communityCreate('data engineering', DATA_ENGINEERING_TAGS, [], dataEngineeringQuestions); + await communityCreate('ui-ux design', DESIGN_TAGS, [], designQuestions); + await communityCreate('data science', DS_TAGS, [], dsQuestions); + await communityCreate('cloud computing', CLOUD_TAGS, [], cloudQuestions); console.log('Database populated'); } catch (err) { From ad604830c3e8c54acdea8919105dfc40c2c252c8 Mon Sep 17 00:00:00 2001 From: g-pooja-03 Date: Sat, 30 Nov 2024 12:44:19 -0400 Subject: [PATCH 2/2] chat page style fixes --- client/src/components/layout/index.css | 2 +- client/src/components/main/chat/index.css | 58 ++++++++++--------- client/src/components/main/chat/index.tsx | 2 +- .../main/questionPage/question/index.css | 1 + client/src/index.css | 1 + 5 files changed, 35 insertions(+), 29 deletions(-) diff --git a/client/src/components/layout/index.css b/client/src/components/layout/index.css index 8156ae0..58a4b5d 100644 --- a/client/src/components/layout/index.css +++ b/client/src/components/layout/index.css @@ -5,7 +5,7 @@ } .right_main { - width: 85%; + width: 88%; overflow: auto; } diff --git a/client/src/components/main/chat/index.css b/client/src/components/main/chat/index.css index a3671a2..63abe87 100644 --- a/client/src/components/main/chat/index.css +++ b/client/src/components/main/chat/index.css @@ -3,9 +3,8 @@ flex-direction: column; justify-content: space-between; align-items: center; - width: 100%; min-height: 90vh; - background-color: #FFFCF5; + background-color:#f5f5f5; overflow-y: scroll; } @@ -17,7 +16,7 @@ .ruled-paper { background-size: 100% 3em; - background-color: #FFFCF5; + background-color: #f5f5f5; flex-grow: 1; width: 100%; padding-top: 0.2rem; @@ -33,7 +32,7 @@ } .community-title { - margin: 0 auto; /* Horizontally center */ + margin: 0 auto; background: #6D89B0; text-align: start; padding: 10px; @@ -47,6 +46,7 @@ padding: 20px; font-size: 24px; font-weight: bold; + white-space: nowrap; } .chat-header { @@ -82,10 +82,12 @@ .chat-text-user, .chat-text-me { display: inline-block; - font-size: 24px; - max-width: 100%; - white-space: nowrap; font-size: 18px; + max-width: 80%; + white-space: normal; + word-wrap: break-word; + word-break: break-word; + overflow-wrap: break-word; padding: 3px 15px; margin-bottom: 10px; clear: both; @@ -93,7 +95,7 @@ .chat-text-user { text-align: left !important; - background: #f1f1f1; + background: #cfcfcf; color: #000 !important; border-radius: 20px 20px 20px 3px; margin-left: 10px; @@ -119,10 +121,9 @@ color: white; } -.search-bar { +.search-bar-users { width: 100%; padding: 8px; - margin-bottom: 16px; font-size: 16px; border-radius: 4px; border: 1px solid #ccc; @@ -134,43 +135,46 @@ } .send { - background: #BABDE2; - border-radius: 10px; - padding: 5px; + background: #6D89B0; + border: none; + border-radius: 4px; + padding: 0.75rem 1.5rem; + font-size: 1rem; + font-weight: bold; color: white; + cursor: pointer; + transition: background 0.3s ease; margin-right: 20px; - font-size: 24px; - font-weight: bold; } .send:hover { - background-color: #9498B5; + background-color: #546a8d; } - .search-container { position: relative; - display: inline-block; + display: flex; + align-items: center; + gap: 0px; width: 100%; padding-top: 10px; + box-sizing: border-box; } .dropdown-list { - display: flex; - flex-direction: row; - align-items: center; - gap: 10px; - margin-left: 16%; - margin-right: 3%; - flex-wrap: wrap; - justify-content: center; + position: absolute; + top: 100%; + left: 0; + width: 100%; background-color: white; color: black; border-radius: 4px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + z-index: 10; + overflow: hidden; } .dropdown-item { padding: 8px 12px; - width: 100%; cursor: pointer; } diff --git a/client/src/components/main/chat/index.tsx b/client/src/components/main/chat/index.tsx index 89b107a..cdf4663 100644 --- a/client/src/components/main/chat/index.tsx +++ b/client/src/components/main/chat/index.tsx @@ -38,7 +38,7 @@ const ChatPage = () => {
chatting now: