diff --git a/packages/pl-api/lib/entities/status.ts b/packages/pl-api/lib/entities/status.ts index 18d37a5c2..dd7b24f4d 100644 --- a/packages/pl-api/lib/entities/status.ts +++ b/packages/pl-api/lib/entities/status.ts @@ -19,7 +19,7 @@ const statusEventSchema = v.object({ name: v.fallback(v.string(), ''), start_time: v.fallback(v.nullable(datetimeSchema), null), end_time: v.fallback(v.nullable(datetimeSchema), null), - join_mode: v.fallback(v.nullable(v.picklist(['free', 'restricted', 'invite'])), null), + join_mode: v.fallback(v.nullable(v.picklist(['free', 'restricted', 'invite', 'external'])), null), participants_count: v.fallback(v.number(), 0), location: v.fallback(v.nullable(v.object({ name: v.fallback(v.string(), ''), diff --git a/packages/pl-api/package.json b/packages/pl-api/package.json index 6df7d29b5..73c958266 100644 --- a/packages/pl-api/package.json +++ b/packages/pl-api/package.json @@ -1,6 +1,6 @@ { "name": "pl-api", - "version": "0.1.3", + "version": "0.1.4", "type": "module", "homepage": "https://github.com/mkljczk/pl-fe/tree/fork/packages/pl-api", "repository": { diff --git a/packages/pl-fe/package.json b/packages/pl-fe/package.json index b6ae6c9e4..96447b653 100644 --- a/packages/pl-fe/package.json +++ b/packages/pl-fe/package.json @@ -102,7 +102,7 @@ "mini-css-extract-plugin": "^2.9.1", "multiselect-react-dropdown": "^2.0.25", "path-browserify": "^1.0.1", - "pl-api": "^0.1.3", + "pl-api": "^0.1.4", "pl-hooks": "^0.0.1", "postcss": "^8.4.47", "process": "^0.11.10", diff --git a/packages/pl-fe/src/components/ui/button/index.tsx b/packages/pl-fe/src/components/ui/button/index.tsx index 373b10754..bf83c5bbf 100644 --- a/packages/pl-fe/src/components/ui/button/index.tsx +++ b/packages/pl-fe/src/components/ui/button/index.tsx @@ -24,6 +24,8 @@ interface IButton extends Pick< text?: React.ReactNode; /** Makes the button into a navlink, if provided. */ to?: string; + /** Makes the button into an anchor, if provided. */ + href?: string; /** Styles the button visually with a predefined theme. */ theme?: ButtonThemes; } @@ -40,6 +42,7 @@ const Button = React.forwardRef(({ text, theme = 'secondary', to, + href, type = 'button', className, ...props @@ -87,6 +90,14 @@ const Button = React.forwardRef(({ ); } + if (href) { + return ( + + {renderButton()} + + ); + } + return renderButton(); }); diff --git a/packages/pl-fe/src/features/event/components/event-action-button.tsx b/packages/pl-fe/src/features/event/components/event-action-button.tsx index f0d7ee84e..9b9f03687 100644 --- a/packages/pl-fe/src/features/event/components/event-action-button.tsx +++ b/packages/pl-fe/src/features/event/components/event-action-button.tsx @@ -30,6 +30,20 @@ const EventActionButton: React.FC = ({ status, theme = 'secondary' const event = status.event!; + if (event.join_mode === 'external') { + return ( + + ); + } + const handleJoin: React.EventHandler = (e) => { e.preventDefault(); diff --git a/packages/pl-fe/yarn.lock b/packages/pl-fe/yarn.lock index 1a831886b..ce5079130 100644 --- a/packages/pl-fe/yarn.lock +++ b/packages/pl-fe/yarn.lock @@ -7570,10 +7570,10 @@ pkg-dir@^4.1.0: dependencies: find-up "^4.0.0" -pl-api@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.1.3.tgz#72d434a0ec8d713e5b227b35497da33cf26975a6" - integrity sha512-vcl3aGOy3AocQek3+S97QB0jIcF+iV66FvMqrFB/qnfo3Ryte9dcG6XcDxQ5LpogFQAILKk/Mm5uY2W9RZtwHA== +pl-api@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.1.4.tgz#8062dc0ac34bb60f7dcbcb556cfbc18a19482948" + integrity sha512-8ZUQeoCgJZFsp9wrrBOEL2wKRPfLf7Jxz9vPTUnGQMPA0BBtQvsgDxomEC96fRjO+ycxK7gEZrKLVEaNFA0nyw== dependencies: blurhash "^2.0.5" http-link-header "^1.1.3" diff --git a/packages/pl-hooks/lib/hooks/statuses/useStatus.ts b/packages/pl-hooks/lib/hooks/statuses/useStatus.ts index a9483c345..36698b075 100644 --- a/packages/pl-hooks/lib/hooks/statuses/useStatus.ts +++ b/packages/pl-hooks/lib/hooks/statuses/useStatus.ts @@ -3,7 +3,6 @@ import { useQueries, useQuery } from '@tanstack/react-query'; import { usePlHooksApiClient } from 'pl-hooks/contexts/api-client'; import { queryClient, usePlHooksQueryClient } from 'pl-hooks/contexts/query-client'; import { importEntities } from 'pl-hooks/importer'; -import { useAccount } from 'pl-hooks/main'; import { type Account, normalizeAccount } from 'pl-hooks/normalizers/normalizeAccount'; import { normalizeStatus, type Status } from '../../normalizers/normalizeStatus';