part of '../settings_modal.dart';

class _KeysSection extends StatelessWidget {
  final PyramidTheme pt;
  const _KeysSection({required this.pt});

  @override
  Widget build(BuildContext context) {
    final keys = [
      ('Schnellsuche', 'Strg+K'),
      ('Raum als gelesen markieren', 'Shift+Esc'),
      ('Zu ungelesen springen', 'Strg+J'),
      ('Linke Leiste ein-/ausblenden', 'Strg+B'),
      ('Mitglieder ein-/ausblenden', 'Strg+Shift+U'),
      ('Nachrichten durchsuchen', 'Strg+F'),
      ('Antworten', 'R'),
      ('Auswahl aufheben', 'Esc'),
    ];

    return SingleChildScrollView(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          _SectionTitle(
              title: 'Tastaturkürzel',
              subtitle: 'Schnelle Aktionen per Tastatur.',
              pt: pt),
          _SettingsGroup(
            title: 'Navigieren',
            pt: pt,
            children: keys.asMap().entries.map((entry) {
              final (action, binding) = entry.value;
              return Column(
                children: [
                  Padding(
                    padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
                    child: Row(
                      children: [
                        Expanded(
                            child: Text(action,
                                style: TextStyle(color: pt.fg, fontSize: 13))),
                        Container(
                          padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
                          decoration: BoxDecoration(
                            color: pt.bg3,
                            borderRadius: BorderRadius.circular(6),
                            border: Border.all(color: pt.border),
                          ),
                          child: Text(binding,
                              style: TextStyle(
                                  color: pt.fgMuted,
                                  fontSize: 12,
                                  fontFamily: 'monospace')),
                        ),
                      ],
                    ),
                  ),
                  if (entry.key < keys.length - 1) _Divider(pt: pt),
                ],
              );
            }).toList(),
          ),
        ],
      ),
    );
  }
}
