From 1ef562cf3c0b204d06e2730cc863df0da0fd1d3c Mon Sep 17 00:00:00 2001 From: Anton Tranelis <31516529+antontranelis@users.noreply.github.com> Date: Tue, 26 Aug 2025 14:22:26 +0200 Subject: [PATCH] feat(lib): hide signup option (#329) * hide signup option * directus pull --- app/src/App.tsx | 1 + .../snapshot/fields/maps/hide_signup.json | 45 + backend/directus-config/specs/item.graphql | 30 +- backend/directus-config/specs/openapi.json | 1034 +++++++++-------- backend/directus-config/specs/system.graphql | 6 +- lib/src/Components/AppShell/AppShell.tsx | 3 + lib/src/Components/AppShell/SetAppState.tsx | 6 + lib/src/Components/AppShell/UserControl.tsx | 16 +- .../Components/AppShell/hooks/useAppState.tsx | 2 + lib/src/types/UtopiaMapProps.d.ts | 1 + 10 files changed, 610 insertions(+), 534 deletions(-) create mode 100644 backend/directus-config/snapshot/fields/maps/hide_signup.json diff --git a/app/src/App.tsx b/app/src/App.tsx index 4707eb27..9156f062 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -155,6 +155,7 @@ function App() { appName={map.name} embedded={embedded} openCollectiveApiKey={config.openCollectiveApiKey} + hideSignup={map.hide_signup} > {tagsApi && } diff --git a/backend/directus-config/snapshot/fields/maps/hide_signup.json b/backend/directus-config/snapshot/fields/maps/hide_signup.json new file mode 100644 index 00000000..0656ea6c --- /dev/null +++ b/backend/directus-config/snapshot/fields/maps/hide_signup.json @@ -0,0 +1,45 @@ +{ + "collection": "maps", + "field": "hide_signup", + "type": "boolean", + "meta": { + "collection": "maps", + "conditions": null, + "display": null, + "display_options": null, + "field": "hide_signup", + "group": null, + "hidden": false, + "interface": "boolean", + "note": null, + "options": null, + "readonly": false, + "required": false, + "sort": 17, + "special": [ + "cast-boolean" + ], + "translations": null, + "validation": null, + "validation_message": null, + "width": "full" + }, + "schema": { + "name": "hide_signup", + "table": "maps", + "data_type": "boolean", + "default_value": false, + "max_length": null, + "numeric_precision": null, + "numeric_scale": null, + "is_nullable": true, + "is_unique": false, + "is_indexed": false, + "is_primary_key": false, + "is_generated": false, + "generation_expression": null, + "has_auto_increment": false, + "foreign_key_table": null, + "foreign_key_column": null + } +} diff --git a/backend/directus-config/specs/item.graphql b/backend/directus-config/specs/item.graphql index ef80a45f..3c91797e 100644 --- a/backend/directus-config/specs/item.graphql +++ b/backend/directus-config/specs/item.graphql @@ -11,6 +11,10 @@ type Query { oceannomads_profiles_by_id(id: ID!, version: String): oceannomads_profiles oceannomads_profiles_aggregated(groupBy: [String], filter: oceannomads_profiles_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [oceannomads_profiles_aggregated!]! oceannomads_profiles_by_version(version: String!, id: ID!): version_oceannomads_profiles + maps(filter: maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [maps!]! + maps_by_id(id: ID!, version: String): maps + maps_aggregated(groupBy: [String], filter: maps_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [maps_aggregated!]! + maps_by_version(version: String!, id: ID!): version_maps attestations(filter: attestations_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [attestations!]! attestations_by_id(id: ID!, version: String): attestations attestations_aggregated(groupBy: [String], filter: attestations_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [attestations_aggregated!]! @@ -111,10 +115,6 @@ type Query { layers_maps_by_id(id: ID!, version: String): layers_maps layers_maps_aggregated(groupBy: [String], filter: layers_maps_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [layers_maps_aggregated!]! layers_maps_by_version(version: String!, id: ID!): version_layers_maps - maps(filter: maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [maps!]! - maps_by_id(id: ID!, version: String): maps - maps_aggregated(groupBy: [String], filter: maps_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [maps_aggregated!]! - maps_by_version(version: String!, id: ID!): version_maps Themes(filter: Themes_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Themes!]! Themes_by_id(id: ID!, version: String): Themes Themes_aggregated(groupBy: [String], filter: Themes_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Themes_aggregated!]! @@ -144,6 +144,8 @@ type Mutation { create_relations_item(data: create_relations_input!): relations create_oceannomads_profiles_items(filter: oceannomads_profiles_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [create_oceannomads_profiles_input!]): [oceannomads_profiles!]! create_oceannomads_profiles_item(data: create_oceannomads_profiles_input!): oceannomads_profiles + create_maps_items(filter: maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [create_maps_input!]): [maps!]! + create_maps_item(data: create_maps_input!): maps create_attestations_items(filter: attestations_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [create_attestations_input!]): [attestations!]! create_attestations_item(data: create_attestations_input!): attestations create_attestations_directus_users_items(filter: attestations_directus_users_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [create_attestations_directus_users_input!]): [attestations_directus_users!]! @@ -194,8 +196,6 @@ type Mutation { create_layers_files_item(data: create_layers_files_input!): layers_files create_layers_maps_items(filter: layers_maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [create_layers_maps_input!]): [layers_maps!]! create_layers_maps_item(data: create_layers_maps_input!): layers_maps - create_maps_items(filter: maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [create_maps_input!]): [maps!]! - create_maps_item(data: create_maps_input!): maps create_Themes_items(filter: Themes_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [create_Themes_input!]): [Themes!]! create_Themes_item(data: create_Themes_input!): Themes create_startEnd_items(filter: startEnd_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [create_startEnd_input!]): [startEnd!]! @@ -215,6 +215,9 @@ type Mutation { update_oceannomads_profiles_items(filter: oceannomads_profiles_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, ids: [ID]!, data: update_oceannomads_profiles_input!): [oceannomads_profiles!]! update_oceannomads_profiles_batch(filter: oceannomads_profiles_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [update_oceannomads_profiles_input!]): [oceannomads_profiles!]! update_oceannomads_profiles_item(id: ID!, data: update_oceannomads_profiles_input!): oceannomads_profiles + update_maps_items(filter: maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, ids: [ID]!, data: update_maps_input!): [maps!]! + update_maps_batch(filter: maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [update_maps_input!]): [maps!]! + update_maps_item(id: ID!, data: update_maps_input!): maps update_attestations_items(filter: attestations_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, ids: [ID]!, data: update_attestations_input!): [attestations!]! update_attestations_batch(filter: attestations_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [update_attestations_input!]): [attestations!]! update_attestations_item(id: ID!, data: update_attestations_input!): attestations @@ -290,9 +293,6 @@ type Mutation { update_layers_maps_items(filter: layers_maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, ids: [ID]!, data: update_layers_maps_input!): [layers_maps!]! update_layers_maps_batch(filter: layers_maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [update_layers_maps_input!]): [layers_maps!]! update_layers_maps_item(id: ID!, data: update_layers_maps_input!): layers_maps - update_maps_items(filter: maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, ids: [ID]!, data: update_maps_input!): [maps!]! - update_maps_batch(filter: maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [update_maps_input!]): [maps!]! - update_maps_item(id: ID!, data: update_maps_input!): maps update_Themes_items(filter: Themes_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, ids: [ID]!, data: update_Themes_input!): [Themes!]! update_Themes_batch(filter: Themes_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [update_Themes_input!]): [Themes!]! update_Themes_item(id: ID!, data: update_Themes_input!): Themes @@ -314,6 +314,8 @@ type Mutation { delete_relations_item(id: ID!): delete_one delete_oceannomads_profiles_items(ids: [ID]!): delete_many delete_oceannomads_profiles_item(id: ID!): delete_one + delete_maps_items(ids: [ID]!): delete_many + delete_maps_item(id: ID!): delete_one delete_attestations_items(ids: [ID]!): delete_many delete_attestations_item(id: ID!): delete_one delete_attestations_directus_users_items(ids: [ID]!): delete_many @@ -364,8 +366,6 @@ type Mutation { delete_layers_files_item(id: ID!): delete_one delete_layers_maps_items(ids: [ID]!): delete_many delete_layers_maps_item(id: ID!): delete_one - delete_maps_items(ids: [ID]!): delete_many - delete_maps_item(id: ID!): delete_one delete_Themes_items(ids: [ID]!): delete_many delete_Themes_item(id: ID!): delete_one delete_startEnd_items(ids: [ID]!): delete_many @@ -403,6 +403,7 @@ type Subscription { directus_policies_mutated(event: EventEnum): directus_policies_mutated relations_mutated(event: EventEnum): relations_mutated oceannomads_profiles_mutated(event: EventEnum): oceannomads_profiles_mutated + maps_mutated(event: EventEnum): maps_mutated attestations_mutated(event: EventEnum): attestations_mutated attestations_directus_users_mutated(event: EventEnum): attestations_directus_users_mutated contactInfos_mutated(event: EventEnum): contactInfos_mutated @@ -428,7 +429,6 @@ type Subscription { layers_directus_users_1_mutated(event: EventEnum): layers_directus_users_1_mutated layers_files_mutated(event: EventEnum): layers_files_mutated layers_maps_mutated(event: EventEnum): layers_maps_mutated - maps_mutated(event: EventEnum): maps_mutated Themes_mutated(event: EventEnum): Themes_mutated startEnd_mutated(event: EventEnum): startEnd_mutated team_mutated(event: EventEnum): team_mutated @@ -1954,6 +1954,7 @@ type maps { tile_server_url: String url: String zoom: Int + hide_signup: Boolean layers(filter: layers_maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [layers_maps] layers_func: count_functions } @@ -2000,6 +2001,7 @@ type maps_aggregated_count { tile_server_url: Int url: Int zoom: Int + hide_signup: Int layers: Int } @@ -2673,6 +2675,7 @@ type version_maps { tile_server_url: String url: String zoom: Int + hide_signup: Boolean layers: JSON } @@ -3221,6 +3224,7 @@ input create_maps_input { tile_server_url: String url: String zoom: Int + hide_signup: Boolean layers: [create_layers_maps_input] } @@ -4200,6 +4204,7 @@ input maps_filter { tile_server_url: string_filter_operators url: string_filter_operators zoom: number_filter_operators + hide_signup: boolean_filter_operators layers: layers_maps_quantifier_filter layers_func: count_function_filter_operators _and: [maps_filter] @@ -4764,6 +4769,7 @@ input update_maps_input { tile_server_url: String url: String zoom: Int + hide_signup: Boolean layers: [update_layers_maps_input] } diff --git a/backend/directus-config/specs/openapi.json b/backend/directus-config/specs/openapi.json index 963a87d2..31ff038d 100644 --- a/backend/directus-config/specs/openapi.json +++ b/backend/directus-config/specs/openapi.json @@ -8678,6 +8678,395 @@ ] } }, + "/items/maps": { + "post": { + "summary": "Create an Item", + "description": "Create a new maps item.", + "tags": [ + "Items", + "ItemsMaps" + ], + "operationId": "createItemsMaps", + "parameters": [ + { + "$ref": "#/components/parameters/Meta" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemsMaps" + } + }, + { + "$ref": "#/components/schemas/ItemsMaps" + } + ] + } + } + } + }, + "responses": { + "200": { + "description": "Successful request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemsMaps" + } + } + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + } + } + }, + "get": { + "summary": "List Items", + "description": "List the maps items.", + "tags": [ + "Items", + "ItemsMaps" + ], + "operationId": "readItemsMaps", + "security": [ + { + "Auth": [] + } + ], + "parameters": [ + { + "$ref": "#/components/parameters/Fields" + }, + { + "$ref": "#/components/parameters/Limit" + }, + { + "$ref": "#/components/parameters/Meta" + }, + { + "$ref": "#/components/parameters/Offset" + }, + { + "$ref": "#/components/parameters/Sort" + }, + { + "$ref": "#/components/parameters/Filter" + }, + { + "$ref": "#/components/parameters/Search" + } + ], + "responses": { + "200": { + "description": "Successful request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/components/schemas/ItemsMaps" + } + }, + "meta": { + "$ref": "#/components/schemas/x-metadata" + } + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + } + } + }, + "patch": { + "summary": "Update Multiple Items", + "description": "Update multiple maps items at the same time.", + "tags": [ + "Items", + "ItemsMaps" + ], + "operationId": "updateItemsMaps", + "parameters": [ + { + "$ref": "#/components/parameters/Fields" + }, + { + "$ref": "#/components/parameters/Limit" + }, + { + "$ref": "#/components/parameters/Meta" + }, + { + "$ref": "#/components/parameters/Offset" + }, + { + "$ref": "#/components/parameters/Sort" + }, + { + "$ref": "#/components/parameters/Filter" + }, + { + "$ref": "#/components/parameters/Search" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemsMaps" + } + }, + { + "$ref": "#/components/schemas/ItemsMaps" + } + ] + } + } + } + }, + "responses": { + "200": { + "description": "Successful request", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemsMaps" + } + } + } + } + } + } + } + } + }, + "delete": { + "summary": "Delete Multiple Items", + "description": "Delete multiple existing maps items.", + "tags": [ + "Items", + "ItemsMaps" + ], + "operationId": "deleteItemsMaps", + "responses": { + "200": { + "description": "Successful request" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + } + }, + "parameters": [] + } + }, + "/items/maps/{id}": { + "get": { + "summary": "Retrieve an Item", + "description": "Retrieve a single maps item by unique identifier.", + "tags": [ + "Items", + "ItemsMaps" + ], + "operationId": "readSingleItemsMaps", + "parameters": [ + { + "$ref": "#/components/parameters/Fields" + }, + { + "$ref": "#/components/parameters/Meta" + }, + { + "$ref": "#/components/parameters/Version" + }, + { + "name": "id", + "description": "Index of the item.", + "in": "path", + "required": true, + "schema": { + "oneOf": [ + { + "type": "integer", + "description": "Incremental index of the item.", + "example": 1 + }, + { + "type": "string", + "description": "Unique identifier of the item.", + "example": "8cbb43fe-4cdf-4991-8352-c461779cec02" + } + ] + } + } + ], + "responses": { + "200": { + "description": "Successful request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object", + "$ref": "#/components/schemas/ItemsMaps" + } + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "404": { + "$ref": "#/components/responses/NotFoundError" + } + } + }, + "patch": { + "summary": "Update an Item", + "description": "Update an existing maps item.", + "tags": [ + "Items", + "ItemsMaps" + ], + "operationId": "updateSingleItemsMaps", + "parameters": [ + { + "$ref": "#/components/parameters/Fields" + }, + { + "$ref": "#/components/parameters/Meta" + }, + { + "name": "id", + "description": "Index of the item.", + "in": "path", + "required": true, + "schema": { + "oneOf": [ + { + "type": "integer", + "description": "Incremental index of the item.", + "example": 1 + }, + { + "type": "string", + "description": "Unique identifier of the item.", + "example": "8cbb43fe-4cdf-4991-8352-c461779cec02" + } + ] + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "$ref": "#/components/schemas/ItemsMaps" + } + } + } + }, + "responses": { + "200": { + "description": "Successful request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object", + "$ref": "#/components/schemas/ItemsMaps" + } + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "404": { + "$ref": "#/components/responses/NotFoundError" + } + } + }, + "delete": { + "summary": "Delete an Item", + "description": "Delete an existing maps item.", + "tags": [ + "Items", + "ItemsMaps" + ], + "operationId": "deleteSingleItemsMaps", + "responses": { + "200": { + "description": "Successful request" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "404": { + "$ref": "#/components/responses/NotFoundError" + } + }, + "parameters": [ + { + "name": "id", + "description": "Index of the item.", + "in": "path", + "required": true, + "schema": { + "oneOf": [ + { + "type": "integer", + "description": "Incremental index of the item.", + "example": 1 + }, + { + "type": "string", + "description": "Unique identifier of the item.", + "example": "8cbb43fe-4cdf-4991-8352-c461779cec02" + } + ] + } + } + ] + } + }, "/items/attestations": { "post": { "summary": "Create an Item", @@ -18403,395 +18792,6 @@ ] } }, - "/items/maps": { - "post": { - "summary": "Create an Item", - "description": "Create a new maps item.", - "tags": [ - "Items", - "ItemsMaps" - ], - "operationId": "createItemsMaps", - "parameters": [ - { - "$ref": "#/components/parameters/Meta" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/components/schemas/ItemsMaps" - } - }, - { - "$ref": "#/components/schemas/ItemsMaps" - } - ] - } - } - } - }, - "responses": { - "200": { - "description": "Successful request", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ItemsMaps" - } - } - } - } - } - } - }, - "401": { - "$ref": "#/components/responses/UnauthorizedError" - } - } - }, - "get": { - "summary": "List Items", - "description": "List the maps items.", - "tags": [ - "Items", - "ItemsMaps" - ], - "operationId": "readItemsMaps", - "security": [ - { - "Auth": [] - } - ], - "parameters": [ - { - "$ref": "#/components/parameters/Fields" - }, - { - "$ref": "#/components/parameters/Limit" - }, - { - "$ref": "#/components/parameters/Meta" - }, - { - "$ref": "#/components/parameters/Offset" - }, - { - "$ref": "#/components/parameters/Sort" - }, - { - "$ref": "#/components/parameters/Filter" - }, - { - "$ref": "#/components/parameters/Search" - } - ], - "responses": { - "200": { - "description": "Successful request", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/components/schemas/ItemsMaps" - } - }, - "meta": { - "$ref": "#/components/schemas/x-metadata" - } - } - } - } - } - }, - "401": { - "$ref": "#/components/responses/UnauthorizedError" - } - } - }, - "patch": { - "summary": "Update Multiple Items", - "description": "Update multiple maps items at the same time.", - "tags": [ - "Items", - "ItemsMaps" - ], - "operationId": "updateItemsMaps", - "parameters": [ - { - "$ref": "#/components/parameters/Fields" - }, - { - "$ref": "#/components/parameters/Limit" - }, - { - "$ref": "#/components/parameters/Meta" - }, - { - "$ref": "#/components/parameters/Offset" - }, - { - "$ref": "#/components/parameters/Sort" - }, - { - "$ref": "#/components/parameters/Filter" - }, - { - "$ref": "#/components/parameters/Search" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/components/schemas/ItemsMaps" - } - }, - { - "$ref": "#/components/schemas/ItemsMaps" - } - ] - } - } - } - }, - "responses": { - "200": { - "description": "Successful request", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ItemsMaps" - } - } - } - } - } - } - } - } - }, - "delete": { - "summary": "Delete Multiple Items", - "description": "Delete multiple existing maps items.", - "tags": [ - "Items", - "ItemsMaps" - ], - "operationId": "deleteItemsMaps", - "responses": { - "200": { - "description": "Successful request" - }, - "401": { - "$ref": "#/components/responses/UnauthorizedError" - } - }, - "parameters": [] - } - }, - "/items/maps/{id}": { - "get": { - "summary": "Retrieve an Item", - "description": "Retrieve a single maps item by unique identifier.", - "tags": [ - "Items", - "ItemsMaps" - ], - "operationId": "readSingleItemsMaps", - "parameters": [ - { - "$ref": "#/components/parameters/Fields" - }, - { - "$ref": "#/components/parameters/Meta" - }, - { - "$ref": "#/components/parameters/Version" - }, - { - "name": "id", - "description": "Index of the item.", - "in": "path", - "required": true, - "schema": { - "oneOf": [ - { - "type": "integer", - "description": "Incremental index of the item.", - "example": 1 - }, - { - "type": "string", - "description": "Unique identifier of the item.", - "example": "8cbb43fe-4cdf-4991-8352-c461779cec02" - } - ] - } - } - ], - "responses": { - "200": { - "description": "Successful request", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "type": "object", - "$ref": "#/components/schemas/ItemsMaps" - } - } - } - } - } - }, - "401": { - "$ref": "#/components/responses/UnauthorizedError" - }, - "404": { - "$ref": "#/components/responses/NotFoundError" - } - } - }, - "patch": { - "summary": "Update an Item", - "description": "Update an existing maps item.", - "tags": [ - "Items", - "ItemsMaps" - ], - "operationId": "updateSingleItemsMaps", - "parameters": [ - { - "$ref": "#/components/parameters/Fields" - }, - { - "$ref": "#/components/parameters/Meta" - }, - { - "name": "id", - "description": "Index of the item.", - "in": "path", - "required": true, - "schema": { - "oneOf": [ - { - "type": "integer", - "description": "Incremental index of the item.", - "example": 1 - }, - { - "type": "string", - "description": "Unique identifier of the item.", - "example": "8cbb43fe-4cdf-4991-8352-c461779cec02" - } - ] - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "$ref": "#/components/schemas/ItemsMaps" - } - } - } - }, - "responses": { - "200": { - "description": "Successful request", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "type": "object", - "$ref": "#/components/schemas/ItemsMaps" - } - } - } - } - } - }, - "401": { - "$ref": "#/components/responses/UnauthorizedError" - }, - "404": { - "$ref": "#/components/responses/NotFoundError" - } - } - }, - "delete": { - "summary": "Delete an Item", - "description": "Delete an existing maps item.", - "tags": [ - "Items", - "ItemsMaps" - ], - "operationId": "deleteSingleItemsMaps", - "responses": { - "200": { - "description": "Successful request" - }, - "401": { - "$ref": "#/components/responses/UnauthorizedError" - }, - "404": { - "$ref": "#/components/responses/NotFoundError" - } - }, - "parameters": [ - { - "name": "id", - "description": "Index of the item.", - "in": "path", - "required": true, - "schema": { - "oneOf": [ - { - "type": "integer", - "description": "Incremental index of the item.", - "example": 1 - }, - { - "type": "string", - "description": "Unique identifier of the item.", - "example": "8cbb43fe-4cdf-4991-8352-c461779cec02" - } - ] - } - } - ] - } - }, "/items/Themes": { "post": { "summary": "Create an Item", @@ -20873,6 +20873,10 @@ "name": "ItemsOceannomadsProfiles", "x-collection": "oceannomads_profiles" }, + { + "name": "ItemsMaps", + "x-collection": "maps" + }, { "name": "ItemsAttestations", "x-collection": "attestations" @@ -20973,10 +20977,6 @@ "name": "ItemsLayersMaps", "x-collection": "layers_maps" }, - { - "name": "ItemsMaps", - "x-collection": "maps" - }, { "name": "ItemsThemes", "x-collection": "Themes" @@ -22997,6 +22997,132 @@ "id" ] }, + "ItemsMaps": { + "type": "object", + "properties": { + "center": { + "nullable": true, + "type": "object" + }, + "custom_text": { + "nullable": true, + "description": "Replace the info text in the info popup", + "type": "string" + }, + "default_theme": { + "nullable": true, + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/ItemsThemes" + } + ] + }, + "donation_widget": { + "nullable": true, + "description": "Shows a donation widget after 10 minutes", + "type": "boolean" + }, + "expand_layer_control": { + "nullable": true, + "type": "boolean" + }, + "geo": { + "nullable": true, + "description": "You can include GeoJSON" + }, + "id": { + "nullable": false, + "type": "string", + "format": "uuid" + }, + "info_open": { + "nullable": true, + "type": "boolean" + }, + "logo": { + "nullable": true, + "description": "Used as FavIcon", + "oneOf": [ + { + "type": "string", + "format": "uuid" + }, + { + "$ref": "#/components/schemas/Files" + } + ] + }, + "name": { + "nullable": true, + "type": "string" + }, + "own_tag_space": { + "nullable": true, + "type": "boolean" + }, + "show_filter_control": { + "nullable": true, + "type": "boolean" + }, + "show_gratitude_control": { + "nullable": true, + "type": "boolean" + }, + "show_layer_control": { + "nullable": true, + "type": "boolean" + }, + "show_theme_control": { + "nullable": true, + "type": "boolean" + }, + "show_zoom_control": { + "nullable": false, + "type": "boolean" + }, + "tile_server_attribution": { + "nullable": true, + "type": "string" + }, + "tile_server_url": { + "nullable": true, + "type": "string" + }, + "url": { + "nullable": true, + "type": "string" + }, + "zoom": { + "nullable": true, + "type": "integer" + }, + "hide_signup": { + "nullable": true, + "type": "boolean" + }, + "layers": { + "nullable": true, + "type": "array", + "items": { + "oneOf": [ + { + "type": "integer" + }, + { + "$ref": "#/components/schemas/ItemsLayersMaps" + } + ] + } + } + }, + "x-collection": "maps", + "required": [ + "id" + ] + }, "ItemsAttestations": { "type": "object", "properties": { @@ -24448,128 +24574,6 @@ }, "x-collection": "layers_maps" }, - "ItemsMaps": { - "type": "object", - "properties": { - "center": { - "nullable": true, - "type": "object" - }, - "custom_text": { - "nullable": true, - "description": "Replace the info text in the info popup", - "type": "string" - }, - "default_theme": { - "nullable": true, - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/components/schemas/ItemsThemes" - } - ] - }, - "donation_widget": { - "nullable": true, - "description": "Shows a donation widget after 10 minutes", - "type": "boolean" - }, - "expand_layer_control": { - "nullable": true, - "type": "boolean" - }, - "geo": { - "nullable": true, - "description": "You can include GeoJSON" - }, - "id": { - "nullable": false, - "type": "string", - "format": "uuid" - }, - "info_open": { - "nullable": true, - "type": "boolean" - }, - "logo": { - "nullable": true, - "description": "Used as FavIcon", - "oneOf": [ - { - "type": "string", - "format": "uuid" - }, - { - "$ref": "#/components/schemas/Files" - } - ] - }, - "name": { - "nullable": true, - "type": "string" - }, - "own_tag_space": { - "nullable": true, - "type": "boolean" - }, - "show_filter_control": { - "nullable": true, - "type": "boolean" - }, - "show_gratitude_control": { - "nullable": true, - "type": "boolean" - }, - "show_layer_control": { - "nullable": true, - "type": "boolean" - }, - "show_theme_control": { - "nullable": true, - "type": "boolean" - }, - "show_zoom_control": { - "nullable": false, - "type": "boolean" - }, - "tile_server_attribution": { - "nullable": true, - "type": "string" - }, - "tile_server_url": { - "nullable": true, - "type": "string" - }, - "url": { - "nullable": true, - "type": "string" - }, - "zoom": { - "nullable": true, - "type": "integer" - }, - "layers": { - "nullable": true, - "type": "array", - "items": { - "oneOf": [ - { - "type": "integer" - }, - { - "$ref": "#/components/schemas/ItemsLayersMaps" - } - ] - } - } - }, - "x-collection": "maps", - "required": [ - "id" - ] - }, "ItemsThemes": { "type": "object", "properties": { diff --git a/backend/directus-config/specs/system.graphql b/backend/directus-config/specs/system.graphql index c623be7e..67f7fae2 100644 --- a/backend/directus-config/specs/system.graphql +++ b/backend/directus-config/specs/system.graphql @@ -265,6 +265,7 @@ type Subscription { directus_policies_mutated(event: EventEnum): directus_policies_mutated relations_mutated(event: EventEnum): relations_mutated oceannomads_profiles_mutated(event: EventEnum): oceannomads_profiles_mutated + maps_mutated(event: EventEnum): maps_mutated attestations_mutated(event: EventEnum): attestations_mutated attestations_directus_users_mutated(event: EventEnum): attestations_directus_users_mutated contactInfos_mutated(event: EventEnum): contactInfos_mutated @@ -290,7 +291,6 @@ type Subscription { layers_directus_users_1_mutated(event: EventEnum): layers_directus_users_1_mutated layers_files_mutated(event: EventEnum): layers_files_mutated layers_maps_mutated(event: EventEnum): layers_maps_mutated - maps_mutated(event: EventEnum): maps_mutated Themes_mutated(event: EventEnum): Themes_mutated startEnd_mutated(event: EventEnum): startEnd_mutated team_mutated(event: EventEnum): team_mutated @@ -2039,6 +2039,7 @@ type maps { tile_server_url: String url: String zoom: Int + hide_signup: Boolean layers(filter: layers_maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [layers_maps] layers_func: count_functions } @@ -2783,6 +2784,7 @@ input create_maps_input { tile_server_url: String url: String zoom: Int + hide_signup: Boolean layers: [create_layers_maps_input] } @@ -3746,6 +3748,7 @@ input maps_filter { tile_server_url: string_filter_operators url: string_filter_operators zoom: number_filter_operators + hide_signup: boolean_filter_operators layers: layers_maps_quantifier_filter layers_func: count_function_filter_operators _and: [maps_filter] @@ -4304,6 +4307,7 @@ input update_maps_input { tile_server_url: String url: String zoom: Int + hide_signup: Boolean layers: [update_layers_maps_input] } diff --git a/lib/src/Components/AppShell/AppShell.tsx b/lib/src/Components/AppShell/AppShell.tsx index 71146b26..4e2a9c34 100644 --- a/lib/src/Components/AppShell/AppShell.tsx +++ b/lib/src/Components/AppShell/AppShell.tsx @@ -15,12 +15,14 @@ export function AppShell({ assetsApi, embedded, openCollectiveApiKey, + hideSignup, }: { appName: string children: React.ReactNode assetsApi: AssetsApi embedded?: boolean openCollectiveApiKey?: string + hideSignup?: boolean }) { return ( @@ -29,6 +31,7 @@ export function AppShell({ assetsApi={assetsApi} embedded={embedded} openCollectiveApiKey={openCollectiveApiKey} + hideSignup={hideSignup} />
diff --git a/lib/src/Components/AppShell/SetAppState.tsx b/lib/src/Components/AppShell/SetAppState.tsx index 10b9e4a6..e27bf4c5 100644 --- a/lib/src/Components/AppShell/SetAppState.tsx +++ b/lib/src/Components/AppShell/SetAppState.tsx @@ -8,10 +8,12 @@ export const SetAppState = ({ assetsApi, embedded, openCollectiveApiKey, + hideSignup, }: { assetsApi: AssetsApi embedded?: boolean openCollectiveApiKey?: string + hideSignup?: boolean }) => { const setAppState = useSetAppState() @@ -27,5 +29,9 @@ export const SetAppState = ({ setAppState({ openCollectiveApiKey }) }, [openCollectiveApiKey, setAppState]) + useEffect(() => { + setAppState({ hideSignup: hideSignup ?? false }) + }, [hideSignup, setAppState]) + return <> } diff --git a/lib/src/Components/AppShell/UserControl.tsx b/lib/src/Components/AppShell/UserControl.tsx index c951d372..ca05f9ee 100644 --- a/lib/src/Components/AppShell/UserControl.tsx +++ b/lib/src/Components/AppShell/UserControl.tsx @@ -93,9 +93,11 @@ export const UserControl = () => {
Login
- -
Sign Up
- + {!appState.hideSignup && ( + +
Sign Up
+ + )}
diff --git a/lib/src/Components/AppShell/hooks/useAppState.tsx b/lib/src/Components/AppShell/hooks/useAppState.tsx index 8d4a52d2..2db08b38 100644 --- a/lib/src/Components/AppShell/hooks/useAppState.tsx +++ b/lib/src/Components/AppShell/hooks/useAppState.tsx @@ -11,6 +11,7 @@ interface AppState { showThemeControl: boolean embedded: boolean openCollectiveApiKey: string + hideSignup: boolean } type UseAppManagerResult = ReturnType @@ -22,6 +23,7 @@ const initialAppState: AppState = { showThemeControl: false, embedded: false, openCollectiveApiKey: '', + hideSignup: false, } const AppContext = createContext({ diff --git a/lib/src/types/UtopiaMapProps.d.ts b/lib/src/types/UtopiaMapProps.d.ts index b5aec550..b808b2fc 100644 --- a/lib/src/types/UtopiaMapProps.d.ts +++ b/lib/src/types/UtopiaMapProps.d.ts @@ -20,4 +20,5 @@ export interface UtopiaMapProps { expandLayerControl?: boolean tileServerUrl?: string tileServerAttribution?: string + hideSignup?: boolean }