summaryrefslogtreecommitdiff
path: root/src/components/UsageInstructions.tsx
blob: 02d0eb347eb4cf39dd0678e0e9857c254801df7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import { useEffect, useState } from "react";
import { PanelSectionRow } from "@decky/ui";
import { getLaunchOption } from "../api/lsfgApi";

export function UsageInstructions() {
  const [launchOption, setLaunchOption] = useState("~/lsfg %command%");
  const [launchExplanation, setLaunchExplanation] = useState(
    "The LSFG wrapper configures frame generation before launching the game."
  );

  useEffect(() => {
    let active = true;

    getLaunchOption()
      .then((result) => {
        if (!active) return;
        if (result.launch_option) setLaunchOption(result.launch_option);
        if (result.explanation) setLaunchExplanation(result.explanation);
      })
      .catch(() => {
        // Keep the standard launch option visible if the backend is unavailable.
      });

    return () => {
      active = false;
    };
  }, []);

  return (
    <>
      <PanelSectionRow>
        <div
          style={{
            fontSize: "14px",
            fontWeight: "bold",
            marginTop: "16px",
            marginBottom: "8px",
            borderBottom: "1px solid rgba(255, 255, 255, 0.2)",
            paddingBottom: "4px",
            color: "white"
          }}
        >
          Usage Instructions
        </div>
      </PanelSectionRow>

      <PanelSectionRow>
        <div
          style={{
            fontSize: "12px",
            lineHeight: "1.4",
            opacity: "0.8",
            whiteSpace: "pre-wrap"
          }}
        >
          Click "Copy Launch Option" button, then paste it into your Steam game's launch options to enable frame generation.
        </div>
      </PanelSectionRow>

      <PanelSectionRow>
        <div
          style={{
        fontSize: "12px",
        lineHeight: "1.4",
        opacity: "0.8",
        backgroundColor: "rgba(255, 255, 255, 0.1)",
        padding: "8px",
        borderRadius: "4px",
        fontFamily: "monospace",
        marginTop: "8px",
        marginBottom: "8px",
        textAlign: "center"
          }}
        >
          <strong>{launchOption}</strong>
        </div>
      </PanelSectionRow>

      <PanelSectionRow>
        <div
          style={{
            fontSize: "11px",
            lineHeight: "1.3",
            opacity: "0.7",
            marginTop: "4px"
          }}
        >
          {launchExplanation}
        </div>
      </PanelSectionRow>

      <PanelSectionRow>
        <div
          style={{
            fontSize: "11px",
            lineHeight: "1.3",
            opacity: "0.6",
            marginTop: "8px"
          }}
        >
          The configuration is stored in ~/.config/lsfg-vk/conf.toml and hot-reloads while games are running.
        </div>
      </PanelSectionRow>
    </>
  );
}