Skip to content

Commit

Permalink
Merge pull request #766 from supertokens/feat/version-matrix
Browse files Browse the repository at this point in the history
feat: sdk compatibility table.
  • Loading branch information
rishabhpoddar authored Jan 3, 2024
2 parents ce79129 + 396fbe1 commit 6e35160
Show file tree
Hide file tree
Showing 6 changed files with 674 additions and 681 deletions.
11 changes: 3 additions & 8 deletions v2/src/components/api/compatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ export type GetCompatibilityResponse = {
driverToFrontend: { [key: string]: string[] };
};

export async function getCompatibility(
planType: "FREE" | "COMMERCIAL",
driver: string,
plugin: string,
frontend: string
): Promise<GetCompatibilityResponse> {
export async function getCompatibility(driver: string, frontend: string): Promise<GetCompatibilityResponse> {
let options: httpNetworking.GETRequestConfig = {
timeout: 50000,
params: {
planType,
planType: "FREE",
plugin: "postgresql",
driver,
plugin,
frontend
}
};
Expand Down
5 changes: 2 additions & 3 deletions v2/src/components/api/drivers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ export type GetSupportedDriversResponse = {

/**
* Fetches a list of supported drivers in format {id: string, displayName: string}
* @param planType free or commercial
*/
export default async function getSupportedDrivers(planType: any): Promise<GetSupportedDriversResponse> {
export default async function getSupportedDrivers(): Promise<GetSupportedDriversResponse> {
let options: httpNetworking.GETRequestConfig = {
timeout: 50000,
params: {
planType: planType === "COMMERCIAL_TRIAL" ? "COMMERCIAL" : planType,
planType: "FREE",
mode: "PRODUCTION"
}
};
Expand Down
4 changes: 0 additions & 4 deletions v2/src/components/api/frontends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ export type GetSupportedFrontendsResponse = {
frontends: GetSupportedFrontendsResponse_Frontend[];
};

/**
* Fetches a list of supported frontend sdk in format {id: string, displayName: string}
* @param planType free or commercial
*/
export default async function getSupportedFrontends(): Promise<GetSupportedFrontendsResponse> {
let options: httpNetworking.GETRequestConfig = {
timeout: 50000,
Expand Down
80 changes: 80 additions & 0 deletions v2/src/components/compatibility/CompatibilitySelect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import React, { useState } from "react";

export type CompatibilitySelectOptionType = {
id: string;
displayName: string;
};

type CompatibilitySelectProps = {
options: CompatibilitySelectOptionType[];
selectedOption: CompatibilitySelectOptionType | undefined;
onOptionSelect: (value: CompatibilitySelectOptionType) => void;
disabled?: boolean;
};

export default function CompatibilitySelect({
onOptionSelect,
options,
selectedOption,
disabled = false
}: CompatibilitySelectProps) {
const [showOptions, setShowOptions] = useState(false);

function showSelectOptions() {
if (disabled === false) {
setShowOptions(true);
}
}

return (
<div
className={`select-container ${disabled === true ? "disabled" : ""}`}
onMouseLeave={() => setShowOptions(false)}
onMouseEnter={() => showSelectOptions()}
// this code make sure that the select options show up in the mobile view
// since there will be no onMouseEnter event there.
onClick={() => showSelectOptions()}
>
<div className="select-action">
<span>{selectedOption !== undefined ? selectedOption.displayName : "Please select"} </span>
<svg
style={{ rotate: showOptions && disabled === false ? "180deg" : undefined }}
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
>
<path
d="M14 8L10 12L6 8"
stroke="#AAAAAA"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
</div>
{showOptions ? (
<div className="select-dropdown-wrapper">
<div className="select-dropdown">
{options.map(option => {
return (
<div
className="select-item"
key={option.id}
onClick={e => {
e.stopPropagation();
onOptionSelect(option);
setShowOptions(false);
}}
>
{option.displayName}
</div>
);
})}
</div>
</div>
) : null}
</div>
);
}
Loading

0 comments on commit 6e35160

Please sign in to comment.