Skip to content

Commit

Permalink
#47 Smart Post Embeds (#49)
Browse files Browse the repository at this point in the history
* feat: Support generic links, vehicle vins, and OBD codes
* Add Vehicle Link parsing
* Add profile link parsing
* feat: List link chips
  • Loading branch information
amattu2 authored Sep 17, 2023
1 parent 323c061 commit 757b5a3
Show file tree
Hide file tree
Showing 26 changed files with 1,833 additions and 60 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"jest.jestCommandLine": "npm run test --"
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ Top Features:
- Individual post page with comments (Similar to Reddit)
- Profile pages with comprehensive information on Activity, Vehicles, Lists, etc
- Integrated Vehicle, List, & Person search functionality
- Enhanced post parsing w/ support for OBD-ii Codes, `@mentions`, `#VIN`, and more

> **Note**: This application uses the native rest.vinwiki.com API,
> **Note**: This application uses the native vinwiki.com API,
> but is not affiliated with VINwiki.com in any way.
# Usage
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/AuthProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export enum ProviderStatus {

const defaultState: ProviderState = { status: ProviderStatus.LOADING, authenticated: false };

const Context = React.createContext<ProviderState | null>(null);
export const Context = React.createContext<ProviderState | null>(null);

export const useAuthProvider = (): ProviderState => {
const contextState = React.useContext(Context);
Expand Down
4 changes: 2 additions & 2 deletions src/components/CreatePost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { DateTimePicker } from '@mui/x-date-pickers';
import dayjs from "dayjs";
import { useAuthProvider } from "../../Providers/AuthProvider";
import { ENDPOINTS, MEDIA_ENDPOINTS, STATUS_OK } from "../../config/Endpoints";
import { PostRouter } from "../FeedPost";
import { ImageUpload } from "../ImageUpload";
import FeedPost from "../FeedPost";
import Loader from "../Loader";
import PlateDecoder from "../PlateDecoder/Dialog";
import ProfileAvatar from "../ProfileAvatar";
Expand Down Expand Up @@ -320,7 +320,7 @@ const CreatePost: FC = () => {
<Step disabled={!stepStatuses[2]} last>
<StepButton onClick={() => setActiveStep(3)}>Preview & Submit</StepButton>
<StyledStepContent>
<PostRouter {...generateDemoPost()} isPreview />
<FeedPost {...generateDemoPost()} isPreview />
<Button disabled={Object.values(stepStatuses).some((s) => !s)} onClick={createPost}>Post</Button>
</StyledStepContent>
</Step>
Expand Down
28 changes: 0 additions & 28 deletions src/components/FeedPost/Components/GenericText.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/FeedPost/Components/PostComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ENDPOINTS } from "../../../config/Endpoints";
import { useAuthProvider } from "../../../Providers/AuthProvider";
import { formatDateTime } from "../../../utils/date";
import ProfileAvatar from "../../ProfileAvatar";
import GenericText from "./GenericText";
import GenericText from "../../GenericText/GenericText";

type Props = {
comment: PostComment;
Expand Down
2 changes: 1 addition & 1 deletion src/components/FeedPost/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useCopyToClipboard } from "usehooks-ts";
import useProgressiveQuality from "../../hooks/useProgressiveQuality";
import PostComments from "./Components/PostComments";
import ProfileBit from "./Components/PostProfile";
import GenericText from "./Components/GenericText";
import GenericText from "../GenericText/GenericText";
import { formatDateTime } from "../../utils/date";
import { useAuthProvider } from "../../Providers/AuthProvider";
import { useFeedProvider } from "../../Providers/FeedProvider";
Expand Down
2 changes: 1 addition & 1 deletion src/components/FeedPost/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { useCopyToClipboard } from "usehooks-ts";
import { useAuthProvider } from "../../Providers/AuthProvider";
import { formatDateTime } from "../../utils/date";
import GenericText from "./Components/GenericText";
import GenericText from "../GenericText/GenericText";
import PostComments from "./Components/PostComments";
import ProfileBit from "./Components/PostProfile";
import DeletePostDialog from "./Components/DeletePostDialog";
Expand Down
2 changes: 1 addition & 1 deletion src/components/FeedPost/VerticalImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useCopyToClipboard } from "usehooks-ts";
import useProgressiveQuality from "../../hooks/useProgressiveQuality";
import PostComments from "./Components/PostComments";
import ProfileBit from "./Components/PostProfile";
import GenericText from "./Components/GenericText";
import GenericText from "../GenericText/GenericText";
import { formatDateTime } from "../../utils/date";
import { useAuthProvider } from "../../Providers/AuthProvider";
import { useFeedProvider } from "../../Providers/FeedProvider";
Expand Down
4 changes: 2 additions & 2 deletions src/components/FeedPost/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { FC, Ref, forwardRef } from "react";
import React, { Ref, forwardRef } from "react";
import ImagePost from "./Image";
import VerticalImagePost from "./VerticalImage";
import TextPost from "./Text";

export const PostRouter: FC<FeedPostProps> = forwardRef((props: FeedPostProps, ref: Ref<HTMLDivElement>) => {
export default forwardRef((props: FeedPostProps, ref: Ref<HTMLDivElement>) => {
switch (props.type) {
case "photo":
if (props.post_text?.length > 50) {
Expand Down
Loading

0 comments on commit 757b5a3

Please sign in to comment.