|
1 | | - |
2 | 1 | # Stack Overflow Teams Frontend Plugin |
3 | 2 |
|
4 | 3 | This package is the **frontend component** of the `stack-overflow-teams` plugin for Backstage. |
5 | 4 |
|
6 | 5 | ## Areas of Responsibility |
7 | 6 |
|
8 | | - It provides the UI and interacts with the [backend service](https://github.com/EstoesMoises/backstage-stackoverflow/tree/main/plugins/stack-overflow-teams-backend) to fetch data from your Stack Overflow Enterprise instance. |
| 7 | +It provides the UI and interacts with the [backend service](https://github.com/EstoesMoises/backstage-stackoverflow/tree/main/plugins/stack-overflow-teams-backend) to fetch data from your Stack Overflow Enterprise instance. |
9 | 8 |
|
10 | 9 | ### Backend Dependency |
11 | 10 |
|
12 | 11 | To fully utilize this plugin, you must also install and configure the corresponding **backend package** (`backstage-plugin-stack-overflow-teams-backend`) in your Backstage backend. The frontend plugin relies on the backend for API communication and authentication handling. |
13 | 12 |
|
14 | 13 | ## More details |
15 | 14 |
|
16 | | - |
17 | 15 | ### Enhanced `<StackOverflowSearchResultListItem />` |
18 | 16 |
|
19 | | -This component, is a modified version of the [community plugin.](https://github.com/backstage/community-plugins/tree/main/workspaces/stack-overflow/plugins/stack-overflow/src/search/StackOverflowSearchResultListItem) |
20 | | - |
21 | | -It adds a more Stack Overflow like interface, adding more information such as the questions' score, user role, user reputation and timestamp for the questions. |
| 17 | +This component is a modified version of the [community plugin.](https://github.com/backstage/community-plugins/tree/main/workspaces/stack-overflow/plugins/stack-overflow/src/search/StackOverflowSearchResultListItem) |
22 | 18 |
|
| 19 | +It adds a more Stack Overflow-like interface, including additional information such as the questions' score, user role, user reputation, and timestamp. |
23 | 20 |
|
24 | 21 | --- |
25 | 22 |
|
26 | 23 | ### Individual Frontend Components |
27 | 24 |
|
| 25 | +- **`<StackOverflowMe />`** |
28 | 26 |
|
| 27 | + Displays information about the authenticated user. |
29 | 28 |
|
30 | | -- **`<StackOverflowMe />`** |
31 | | - |
32 | | -Displays information about the authenticated user. |
33 | | - |
| 29 | +- **`<StackOverflowPostQuestionModal />`** |
34 | 30 |
|
| 31 | + Provides a form for users to create a new Stack Overflow question. Once submitted, an API request is executed to create the question. |
| 32 | + |
| 33 | + This form listens to the `'openAskQuestionModal'` event. You can utilize this anywhere in your Backstage UI. To invoke the form, add the component to your UI along with a button that dispatches the event. Example: |
35 | 34 |
|
36 | | -- **`<StackOverflowPostQuestionModal />`** |
37 | | - |
38 | | -Provides a form for users to create a new Stack Overflow question. Once submitted, an API request is executed to create the question. |
39 | | - |
40 | | -This form listens to the `'openAskQuestionModal'` event. You can utilize this anywhere in you Backstage UI, to invoque the form you must add the component to your UI, but also a button that dispatches the event. E.g.: |
41 | | - |
42 | | - <SidebarItem |
43 | | - |
| 35 | + ```tsx |
| 36 | + <SidebarItem |
44 | 37 | icon={StackOverflowIcon} |
45 | | - |
46 | | - onClick={() => window.dispatchEvent(new Event('openAskQuestionModal'))} |
47 | | - |
| 38 | + onClick={() => window.dispatchEvent(new Event('openAskQuestionModal'))} |
48 | 39 | text="Ask a Question" |
49 | | - |
50 | | - /> |
51 | | - |
52 | | - <StackOverflowPostQuestionModal /> |
53 | | - |
| 40 | + /> |
54 | 41 |
|
| 42 | + <StackOverflowPostQuestionModal /> |
| 43 | + ``` |
55 | 44 |
|
56 | | -- **`<StackOverflowQuestion />`** |
57 | | - |
58 | | -Retrieves questions from the API. Uses standard pagination, displaying only the first 30 API results. |
59 | | - |
| 45 | +- **`<StackOverflowQuestion />`** |
60 | 46 |
|
| 47 | + Retrieves questions from the API. Uses standard pagination, displaying only the first 30 API results. |
61 | 48 |
|
62 | | -- **`<StackOverflowTags />`** |
63 | | - |
64 | | -Retrieves tags from the API. Uses standard pagination, displaying only the first 30 API results. |
65 | | - |
| 49 | +- **`<StackOverflowTags />`** |
66 | 50 |
|
| 51 | + Retrieves tags from the API. Uses standard pagination, displaying only the first 30 API results. |
67 | 52 |
|
68 | | -- **`<StackOverflowUsers />`** |
69 | | - |
70 | | -Retrieves users from the API. Uses standard pagination, displaying only the first 30 API results. |
71 | | - |
72 | | -- **`<StackOverflowHub />`** |
73 | | - |
74 | | -The below various components collectively create this informative hub. |
75 | | - |
| 53 | +- **`<StackOverflowUsers />`** |
76 | 54 |
|
| 55 | + Retrieves users from the API. Uses standard pagination, displaying only the first 30 API results. |
77 | 56 |
|
78 | | -## Authentication Components |
79 | | - |
| 57 | +- **`<StackOverflowHub />`** |
80 | 58 |
|
| 59 | + Various components collectively create this informative hub. |
81 | 60 |
|
82 | | -- **`<StackAuthStart />`** |
83 | | - |
84 | | -Initiates **`/auth/start`** on the backend. |
| 61 | +## Authentication Components |
85 | 62 |
|
| 63 | +- **`<StackAuthStart />`** |
86 | 64 |
|
| 65 | + Initiates **`/auth/start`** on the backend. |
87 | 66 |
|
88 | | -- **`<StackAuthLoading />`** |
89 | | - |
90 | | -Handles loading state during authentication. |
91 | | - |
| 67 | +- **`<StackAuthLoading />`** |
92 | 68 |
|
| 69 | + Handles the loading state during authentication. |
93 | 70 |
|
94 | | -- **`<StackAuthCallback />`** |
95 | | - |
96 | | -Receives the code and state from your Stack Overflow Enterprise instance as part of the OAuth process and initiates **`/callback`** in the backend. |
97 | | - |
| 71 | +- **`<StackAuthCallback />`** |
98 | 72 |
|
| 73 | + Receives the code and state from your Stack Overflow Enterprise instance as part of the OAuth process and initiates **`/callback`** in the backend. |
99 | 74 |
|
100 | | -- **`<StackAuthSuccess />`** |
101 | | - |
102 | | -Displays authentication success state. |
103 | | - |
| 75 | +- **`<StackAuthSuccess />`** |
104 | 76 |
|
| 77 | + Displays authentication success state. |
105 | 78 |
|
106 | | -- **`<StackAuthFailed />`** |
107 | | - |
108 | | -Displays authentication failure state. |
109 | | - |
| 79 | +- **`<StackAuthFailed />`** |
110 | 80 |
|
| 81 | + Displays authentication failure state. |
111 | 82 |
|
112 | 83 | ### Page |
113 | 84 |
|
| 85 | +- **`<StackOverflowTeamsPage />`** |
114 | 86 |
|
115 | | - |
116 | | -- **`<StackOverflowTeamsPage />`** |
117 | | - |
118 | | - |
119 | | - |
120 | | -This page triggers authentication components, it bundles and orchestrates everything for you so you don't have to use the authentication components separated. If authenticated, it will return the `<StackOverflowHub />`. |
121 | | - |
122 | | - |
| 87 | + This page triggers authentication components, bundles, and orchestrates everything for you so you don't have to use the authentication components separately. If authenticated, it will return the `<StackOverflowHub />`. |
123 | 88 |
|
124 | 89 | ### API Requests |
125 | 90 |
|
126 | | - |
127 | | - |
128 | | -The frontend plugin creates an API Ref for StackOverflow for Teams, which can be found under the `/api` folder. **All API requests from the frontend are directed to Backstage's backend**. |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
| 91 | +The frontend plugin creates an API Ref for Stack Overflow for Teams, which can be found under the `/api` folder. **All API requests from the frontend are directed to Backstage's backend**. |
0 commit comments