-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from cherylli/dev
merge dev into main
- Loading branch information
Showing
8 changed files
with
270 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {Submission} from "@/types/SoloProjectTypes"; | ||
import {Table, TableBody, TableCell, TableRow} from "@/components/ui/table"; | ||
import Link from "next/link"; | ||
|
||
const CompactList = ({records}:{records:Submission[]}) => { | ||
return( | ||
<Table className="w-[90%] mx-auto border-2 border-amber-950"> | ||
<TableBody> | ||
{records.map(record=>( | ||
<TableRow key={record.id}> | ||
<Link href={`/solo-project/${record.id}`} target="_blank" rel="noopener noreferrer"> | ||
<TableCell>{record.fields.Timestamp.toString()}</TableCell> | ||
<TableCell>{record.fields["Evaluation Status"]}</TableCell> | ||
</Link> | ||
</TableRow> | ||
))} | ||
</TableBody> | ||
</Table> | ||
) | ||
} | ||
|
||
export default CompactList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,64 @@ | ||
import Airtable, {FieldSet, Record, Records} from "airtable"; | ||
import {EvaluationStatus, Submission, VoyageRole} from "@/types/SoloProjectTypes"; | ||
|
||
const base = new Airtable({apiKey: process.env.AIRTABLE_PAT}) | ||
.base(process.env.AIRTABLE_BASEID as string) | ||
|
||
const table = base(process.env.AIRTABLE_TABLEID as string) | ||
const userTable = base(process.env.AIRTABLE_USERS_TABLEID as string) | ||
|
||
const fields = [ | ||
"Discord Name", | ||
"GitHub ID", | ||
"Timestamp", | ||
"Tier", | ||
"GitHub Repo URL", | ||
"Deployed App URL", | ||
"Evaluation Status", | ||
"Evaluator", | ||
"Evaluation Feedback", | ||
"Instructions", | ||
"Addl. Comments", | ||
"Voyage Role (from Applications link)", | ||
"Discord ID" | ||
] | ||
|
||
const transformData = (records:Records<FieldSet>): Submission[] => { | ||
return records.map((record: Record<FieldSet>)=>{ | ||
return { | ||
id: record.id, | ||
commentCount: record.commentCount as number, | ||
fields: { | ||
"Discord Name": record.fields["Discord Name"] as string, | ||
"GitHub ID": record.fields["GitHub ID"] as string, | ||
"Timestamp": record.fields["Timestamp"] as string, | ||
"Tier": record.fields["Tier"] as string, | ||
"GitHub Repo URL": record.fields["GitHub Repo URL"] as string, | ||
"Deployed App URL": record.fields["Deployed App URL"] as string, | ||
"Evaluation Status": record.fields["Evaluation Status"] as EvaluationStatus, | ||
"Evaluator": record.fields["Evaluator"] as string, | ||
"Evaluation Feedback": record.fields["Evaluation Feedback"] as string, | ||
"Instructions": record.fields["Instructions"] as string, | ||
"Addl. Comments": record.fields["Addl. Comments"] as string, | ||
"Voyage Role (from Applications link)": record.fields["Voyage Role (from Applications link)"] as VoyageRole, | ||
"Discord ID": record.fields["Discord ID"] as string | ||
} | ||
} | ||
}) | ||
} | ||
|
||
// TODO: might be able to refactor the following duplicated code | ||
const transformDataSingleRecord = (record:Record<FieldSet>) => { | ||
return { | ||
id: record.id, | ||
commentCount: record.commentCount as number, | ||
fields: { | ||
"Discord Name": record.fields["Discord Name"] as string, | ||
"GitHub ID": record.fields["GitHub ID"] as string, | ||
"Timestamp": record.fields["Timestamp"] as string, | ||
"Tier": record.fields["Tier"] as string, | ||
"GitHub Repo URL": record.fields["GitHub Repo URL"] as string, | ||
"Deployed App URL": record.fields["Deployed App URL"] as string, | ||
"Evaluation Status": record.fields["Evaluation Status"] as EvaluationStatus, | ||
"Evaluator": record.fields["Evaluator"] as string, | ||
"Evaluation Feedback": record.fields["Evaluation Feedback"] as string, | ||
"Instructions": record.fields["Instructions"] as string, | ||
"Addl. Comments": record.fields["Addl. Comments"] as string, | ||
"Voyage Role (from Applications link)": record.fields["Voyage Role (from Applications link)"] as VoyageRole, | ||
"Discord ID": record.fields["Discord ID"] as string | ||
} | ||
} | ||
} | ||
|
||
export { | ||
table, | ||
userTable, | ||
fields, | ||
transformData, | ||
transformDataSingleRecord | ||
import Airtable, {FieldSet, Record, Records} from "airtable"; | ||
import {EvaluationStatus, Submission, VoyageRole} from "@/types/SoloProjectTypes"; | ||
|
||
const base = new Airtable({apiKey: process.env.AIRTABLE_PAT}) | ||
.base(process.env.AIRTABLE_BASEID as string) | ||
|
||
const table = base(process.env.AIRTABLE_TABLEID as string) | ||
const userTable = base(process.env.AIRTABLE_USERS_TABLEID as string) | ||
|
||
const fields = [ | ||
"Email", | ||
"Discord Name", | ||
"GitHub ID", | ||
"Timestamp", | ||
"Tier", | ||
"GitHub Repo URL", | ||
"Deployed App URL", | ||
"Evaluation Status", | ||
"Evaluator", | ||
"Evaluation Feedback", | ||
"Instructions", | ||
"Addl. Comments", | ||
"Voyage Role (from Applications link)", | ||
"Discord ID" | ||
] | ||
|
||
const transformRecord = (record: Record<FieldSet>) => { | ||
return { | ||
id: record.id, | ||
commentCount: record.commentCount as number, | ||
fields: { | ||
"Email": record.fields["Email"] as string, | ||
"Discord Name": record.fields["Discord Name"] as string, | ||
"GitHub ID": record.fields["GitHub ID"] as string, | ||
"Timestamp": record.fields["Timestamp"] as string, | ||
"Tier": record.fields["Tier"] as string, | ||
"GitHub Repo URL": record.fields["GitHub Repo URL"] as string, | ||
"Deployed App URL": record.fields["Deployed App URL"] as string, | ||
"Evaluation Status": record.fields["Evaluation Status"] as EvaluationStatus, | ||
"Evaluator": record.fields["Evaluator"] as string, | ||
"Evaluation Feedback": record.fields["Evaluation Feedback"] as string, | ||
"Instructions": record.fields["Instructions"] as string, | ||
"Addl. Comments": record.fields["Addl. Comments"] as string, | ||
"Voyage Role (from Applications link)": record.fields["Voyage Role (from Applications link)"] as VoyageRole, | ||
"Discord ID": record.fields["Discord ID"] as string | ||
} | ||
} | ||
} | ||
|
||
const transformData = (records:Records<FieldSet>): Submission[] => { | ||
return records.map((record: Record<FieldSet>)=>transformRecord(record)) | ||
} | ||
|
||
const transformDataSingleRecord = (record:Record<FieldSet>) => { | ||
return transformRecord(record) | ||
} | ||
|
||
export { | ||
table, | ||
userTable, | ||
fields, | ||
transformData, | ||
transformDataSingleRecord | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Sometimes on airtable, VoyageRole would be something like ["Software Developer", "Software Developer"] | ||
// due to members having multiple applications | ||
// IF the roles are the same, it will just return one - for `roleColors` | ||
// Otherwise, it will return "unknown" | ||
import {VoyageRole} from "@/types/SoloProjectTypes"; | ||
|
||
export const parseRole = (role: VoyageRole): VoyageRole => { | ||
const set = new Set(role) | ||
if (set.size === 1) return [...set].toString() as VoyageRole | ||
return "unknown" | ||
} |
Oops, something went wrong.