Skip to content

Commit

Permalink
Merge branch 'main' into feat/anon-company-reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-salgado authored Aug 19, 2024
2 parents 5f0d123 + 39af610 commit f6b8e70
Show file tree
Hide file tree
Showing 48 changed files with 2,583 additions and 1,136 deletions.
333 changes: 155 additions & 178 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions CONTRIBUTORS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@
- Capn05
- Hamza-Mos
- jasonappah
- EmmanuelKey
- gpolite0
- Habeebah157
- bryanansong
- nathanallen242
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<p align="center"><b>Oyster</b>: The open-source software that powers the ColorStack community experience. ✊🏿✊🏾✊🏽✊🏼</p>

<h4 align="center">
<a href="https://colorstack.org">Website</a> |
<a href="https://github.com/colorstackorg/oyster/blob/main/CONTRIBUTING.md">How to Contribute</a> |
<a href="https://colorstack.org">Website</a> |
<a href="https://app.colorstack.io/apply">Family Application</a>
</h4>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import {
} from '@remix-run/react';
import dayjs from 'dayjs';

import { getResumeBook, updateResumeBook } from '@oyster/core/resume-books';
import { getResumeBook, updateResumeBook } from '@oyster/core/resumes';
import {
RESUME_BOOK_TIMEZONE,
UpdateResumeBookInput,
} from '@oyster/core/resume-books.types';
} from '@oyster/core/resumes.types';
import {
ResumeBookEndDateField,
ResumeBookHiddenField,
ResumeBookNameField,
ResumeBookStartDateField,
} from '@oyster/core/resume-books.ui';
} from '@oyster/core/resumes.ui';
import { Button, getErrors, Modal, validateForm } from '@oyster/ui';

import { Route } from '@/shared/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {
import { Form as RemixForm, useActionData, useFetcher } from '@remix-run/react';
import { useEffect } from 'react';

import { createResumeBook } from '@oyster/core/resume-books';
import { createResumeBook } from '@oyster/core/resumes';
import {
ResumeBookEndDateField,
ResumeBookHiddenField,
ResumeBookNameField,
ResumeBookStartDateField,
} from '@oyster/core/resume-books.ui';
} from '@oyster/core/resumes.ui';
import {
Button,
ComboboxPopover,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import dayjs from 'dayjs';
import { useState } from 'react';
import { Clipboard, Edit, ExternalLink, Menu, Plus } from 'react-feather';

import { listResumeBooks } from '@oyster/core/resume-books';
import { listResumeBooks } from '@oyster/core/resumes';
import {
Dashboard,
Dropdown,
Expand Down
1 change: 1 addition & 0 deletions apps/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ STUDENT_PROFILE_URL=http://localhost:3000
# SLACK_BOT_TOKEN=
# SLACK_CLIENT_ID=
# SLACK_CLIENT_SECRET=
# SLACK_FEED_CHANNEL_ID=
# SLACK_INTRODUCTIONS_CHANNEL_ID=
# SLACK_SIGNING_SECRET=
# SMTP_HOST=
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
educationWorker,
emailMarketingWorker,
eventWorker,
feedWorker,
gamificationWorker,
memberEmailWorker,
memberWorker,
Expand Down Expand Up @@ -85,6 +86,7 @@ function initializeBullWorkers() {
educationWorker.run();
emailMarketingWorker.run();
eventWorker.run();
feedWorker.run();
gamificationWorker.run();
memberWorker.run();
memberEmailWorker.run();
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/shared/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const BaseEnvironmentConfig = z.object({
SLACK_BOT_TOKEN: EnvironmentVariable,
SLACK_CLIENT_ID: EnvironmentVariable,
SLACK_CLIENT_SECRET: EnvironmentVariable,
SLACK_FEED_CHANNEL_ID: EnvironmentVariable,
SLACK_INTRODUCTIONS_CHANNEL_ID: EnvironmentVariable,
SLACK_SIGNING_SECRET: EnvironmentVariable,
STUDENT_PROFILE_URL: EnvironmentVariable,
Expand Down Expand Up @@ -80,6 +81,7 @@ const EnvironmentConfig = z.discriminatedUnion('ENVIRONMENT', [
SLACK_BOT_TOKEN: true,
SLACK_CLIENT_ID: true,
SLACK_CLIENT_SECRET: true,
SLACK_FEED_CHANNEL_ID: true,
SLACK_INTRODUCTIONS_CHANNEL_ID: true,
SLACK_SIGNING_SECRET: true,
SWAG_UP_CLIENT_ID: true,
Expand Down
2 changes: 1 addition & 1 deletion apps/member-profile/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { redirect } from '@remix-run/node';
import { generatePath } from '@remix-run/react';

import { getResumeBook } from '@oyster/core/resume-books';
import { getResumeBook } from '@oyster/core/resumes';

import { Route } from '@/shared/constants';

Expand Down
28 changes: 21 additions & 7 deletions apps/member-profile/app/routes/_profile.points.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
useSubmit,
} from '@remix-run/react';
import dayjs from 'dayjs';
import { emojify } from 'node-emoji';
import { Award, Plus } from 'react-feather';
import { match } from 'ts-pattern';
import { z } from 'zod';
Expand Down Expand Up @@ -41,6 +42,7 @@ import {
EmptyStateContainer,
} from '@/shared/components/empty-state';
import { Leaderboard } from '@/shared/components/leaderboard';
import { SlackMessage } from '@/shared/components/slack-message';
import { Route } from '@/shared/constants';
import { getTimezone } from '@/shared/cookies.server';
import { ensureUserAuthenticated, user } from '@/shared/session.server';
Expand Down Expand Up @@ -79,7 +81,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
const id = user(session);

const [
{ completedActivities, totalActivitiesCompleted },
{ completedActivities: _completedActivities, totalActivitiesCompleted },
points,
pointsLeaderboard,
activities,
Expand Down Expand Up @@ -109,6 +111,18 @@ export async function loader({ request }: LoaderFunctionArgs) {
user: id,
});

const completedActivities = _completedActivities.map((activity) => {
if (activity.messageReactedToText) {
activity.messageReactedToText = emojify(activity.messageReactedToText);
}

if (activity.threadRepliedToText) {
activity.threadRepliedToText = emojify(activity.threadRepliedToText);
}

return activity;
});

return json({
activities,
completedActivities,
Expand Down Expand Up @@ -595,12 +609,12 @@ function ActivityHistoryItemDescription({
<div className="flex gap-2">
<div className="border-r-2 border-r-gray-300" />

<Text
className="line-clamp-5 whitespace-pre-wrap [word-break:break-word]"
<SlackMessage
className="line-clamp-10 [word-break:break-word]"
color="gray-500"
>
{activity.messageReactedToText}
</Text>
</SlackMessage>
</div>
</div>
);
Expand All @@ -624,12 +638,12 @@ function ActivityHistoryItemDescription({
<div className="flex gap-2">
<div className="border-r-2 border-r-gray-300" />

<Text
className="line-clamp-5 whitespace-pre-wrap [word-break:break-word]"
<SlackMessage
className="line-clamp-10 [word-break:break-word]"
color="gray-500"
>
{activity.threadRepliedToText}
</Text>
</SlackMessage>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { emojify } from 'node-emoji';
import { listSlackMessages } from '@oyster/core/slack.server';

import { getDateRange, Recap } from '@/routes/_profile.recap.$date';
import { SlackMessage } from '@/shared/components/slack-message';
import { SlackMessageCard } from '@/shared/components/slack-message';
import { ENV } from '@/shared/constants.server';
import { ensureUserAuthenticated } from '@/shared/session.server';

Expand Down Expand Up @@ -54,7 +54,7 @@ export default function RecapAnnouncements() {
<ul className="flex flex-col gap-4">
{announcements.map((announcement) => {
return (
<SlackMessage
<SlackMessageCard
key={announcement.id}
channelId={announcement.channelId}
messageId={announcement.id}
Expand Down
46 changes: 35 additions & 11 deletions apps/member-profile/app/routes/_profile.resources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
type ResourceType,
} from '@oyster/core/resources';
import { listResources, listTags } from '@oyster/core/resources.server';
import { ISO8601Date } from '@oyster/types';
import {
Dashboard,
ExistingSearchParams,
Expand All @@ -28,7 +29,7 @@ import {
Select,
Text,
} from '@oyster/ui';
import { iife } from '@oyster/utils';
import { run } from '@oyster/utils';

import { ListSearchParams } from '@/member-profile.ui';
import { Resource } from '@/shared/components/resource';
Expand All @@ -42,10 +43,11 @@ const ResourcesSearchParams = ListSearchParams.pick({
limit: true,
page: true,
}).extend({
[whereKeys.id]: ListResourcesWhere.shape.id.catch(undefined),
[whereKeys.search]: ListResourcesWhere.shape.search,
[whereKeys.tags]: ListResourcesWhere.shape.tags.catch([]),
date: ISO8601Date.optional().catch(undefined),
id: ListResourcesWhere.shape.id.catch(undefined),
orderBy: ListResourcesOrderBy,
search: ListResourcesWhere.shape.search,
tags: ListResourcesWhere.shape.tags.catch([]),
});

export async function loader({ request }: LoaderFunctionArgs) {
Expand Down Expand Up @@ -83,9 +85,21 @@ export async function loader({ request }: LoaderFunctionArgs) {
id: searchParams.id,
search: searchParams.search,
tags: searchParams.tags,

...(searchParams.date &&
run(() => {
const date = dayjs(searchParams.date).tz('America/Los_Angeles', true);

return {
postedAfter: date.startOf('day').toDate(),
postedBefore: date.endOf('day').toDate(),
};
})),
},
});

const tz = getTimezone(request);

const resources = await Promise.all(
records.map(
async ({
Expand Down Expand Up @@ -123,7 +137,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
postedAt: dayjs().to(postedAt),

postedAtExpanded: dayjs(postedAt)
.tz(getTimezone(request))
.tz(tz)
.format('MMM DD, YYYY • h:mm A'),

// This is the URL that can be shared with others to view the
Expand All @@ -140,16 +154,25 @@ export async function loader({ request }: LoaderFunctionArgs) {
)
);

const tags = await iife(async () => {
const result: { id: string; name: string; param: string }[] = [];
const tags = await run(async () => {
const result: { name: string; param: string; value?: string }[] = [];

if (searchParams.date) {
const date = dayjs(searchParams.date).tz(tz, true).format('M/D/YY');

result.push({
name: `Date: ${date}`,
param: 'date',
});
}

// If there is an ID in the search params, we want to show a tag for it
// to make it clear that the search is for a specific resource.
if (searchParams.id && resources[0]) {
result.push({
id: searchParams.id,
name: resources[0].title as string,
param: whereKeys.id,
value: searchParams.id,
});
}

Expand All @@ -163,8 +186,9 @@ export async function loader({ request }: LoaderFunctionArgs) {

tags.forEach((tag) => {
result.push({
...tag,
name: tag.name,
param: whereKeys.tags,
value: tag.id,
});
});
}
Expand Down Expand Up @@ -272,10 +296,10 @@ function CurrentTagsList() {

// Since there could be multiple tags, we need to specify the value
// along with the key.
searchParams.delete(tag.param, tag.id);
searchParams.delete(tag.param, tag.value);

return (
<li key={tag.id}>
<li key={tag.value || tag.param}>
<Pill
color="pink-100"
onCloseHref={{ search: searchParams.toString() }}
Expand Down
Loading

0 comments on commit f6b8e70

Please sign in to comment.